Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
feat: always append the recorder name to the output directory
Browse files Browse the repository at this point in the history
  • Loading branch information
lachrist committed Jun 22, 2022
1 parent 41698af commit aff3ab1
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ The most frequently used `appmap-agent-js` parameters are:
- `--command="_start command_"` : alternate method of specifying the app- or tests-starting command, wrapped in quotes
- `--log-level=[debug|info|warning|error]` : defaults to `info`
- `--log-file=_file_` : location of log file, defaults to `stderr`
- `--appmap-dir=_directory_` : location of recorded AppMap files, default is `tmp/appmap` or `tmp/appmap/mocha`
- `--appmap-dir=_directory_` : location of recorded AppMap files, default is `tmp/appmap`.

### Example

Expand Down
12 changes: 0 additions & 12 deletions components/configuration-accessor/default/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,6 @@ export default (dependencies) => {
configuration.repository.directory,
);
}
if (
configuration.recorder === "mocha" &&
configuration.appmap_dir === urlifyPath("tmp/appmap", configuration.repository.directory)
) {
configuration = extendConfiguration(
configuration,
{
appmap_dir: "tmp/appmap/mocha",
},
configuration.repository.directory,
);
}
return configuration;
},
resolveConfigurationManualRecorder: (configuration) => {
Expand Down
7 changes: 4 additions & 3 deletions components/receptor-file/default/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ export default (dependencies) => {
recorder === "mocha" || recorder === "process",
"invalid recorder for receptor-file",
);
await createDirectoryAsync(directory);
const recorder_directory = appendURLSegment(directory, recorder);
await createDirectoryAsync(recorder_directory);
const server = createServer();
const urls = new _Set();
server.on("connection", (socket) => {
Expand All @@ -143,13 +144,13 @@ export default (dependencies) => {
sendBackend(backend, ["stop", key, disconnection]);
}
for (const key of getBackendTraceIterator(backend)) {
store(urls, directory, takeBackendTrace(backend, key));
store(urls, recorder_directory, takeBackendTrace(backend, key));
}
});
socket.on("message", (content) => {
if (sendBackend(backend, parseJSON(content))) {
for (const key of getBackendTraceIterator(backend)) {
store(urls, directory, takeBackendTrace(backend, key));
store(urls, recorder_directory, takeBackendTrace(backend, key));
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions components/receptor-file/default/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const receptor = await openReceptorAsync(
socket.end();
});
await closeReceptorAsync(receptor);
await readFileAsync(new URL(`${url}/directory/anonymous.appmap.json`));
await readFileAsync(new URL(`${url}/directory/anonymous-1.appmap.json`));
await readFileAsync(new URL(`${url}/directory/map-name.appmap.json`));
await readFileAsync(new URL(`${url}/directory/process/anonymous.appmap.json`));
await readFileAsync(new URL(`${url}/directory/process/anonymous-1.appmap.json`));
await readFileAsync(new URL(`${url}/directory/process/map-name.appmap.json`));
}
2 changes: 1 addition & 1 deletion test/system/cli/classmap.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await runAsync(
async (directory) => {
const appmap = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down
2 changes: 1 addition & 1 deletion test/system/cli/event-apply-source.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ await runAsync(
events: [{ lineno }],
} = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down
2 changes: 1 addition & 1 deletion test/system/cli/event-apply.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ await runAsync(
async (directory) => {
const appmap = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down
2 changes: 1 addition & 1 deletion test/system/cli/event-http.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ await runAsync(
async (directory) => {
const appmap = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down
2 changes: 1 addition & 1 deletion test/system/cli/event-query.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ await runAsync(
async (directory) => {
const appmap = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down
2 changes: 1 addition & 1 deletion test/system/cli/metadata.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ await runAsync(
async (directory) => {
const appmap = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down
2 changes: 1 addition & 1 deletion test/system/cli/npx.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ await runAsync(
async (directory) => {
const appmap = JSON.parse(
await readFileAsync(
joinPath(directory, "tmp", "appmap", "basename.appmap.json"),
joinPath(directory, "tmp", "appmap", "process", "basename.appmap.json"),
"utf8",
),
);
Expand Down

0 comments on commit aff3ab1

Please sign in to comment.