Skip to content

Commit

Permalink
update remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmail committed Aug 19, 2024
1 parent f541953 commit af87b0e
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import { renderSideEffects, renderSmallLink } from "./render_side_effects.js";
* @param {Object} snapshotTestsOptions
* @param {string|url} snapshotTestsOptions.outFilePattern
* @param {string|url} snapshotTestsOptions.rootDirectoryUrl
* @param {Object} [snapshotTestsOptions.executionEffects]
* @param {boolean} [snapshotTestsOptions.executionEffects.catch=true]
* Any error thrown by test function is detected and added to side effects
* @param {boolean} [snapshotTestsOptions.executionEffects.return=true]
* Test function return value is added to side effects
* @param {Object} [snapshotTestsOptions.filesystemActions]
* Control what to do when there is a file side effect
* "compare", "compare_presence_only", "undo", "ignore"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [0_error](../../new_url_directory.test.mjs#L25)
# [0_error](../../new_url_directory.test.mjs#L27)

```js
run({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [1_copy](../../new_url_directory.test.mjs#L29)
# [1_copy](../../new_url_directory.test.mjs#L31)

```js
run({
Expand Down
24 changes: 14 additions & 10 deletions tests/build/new_url_directory/new_url_directory.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ const run = async ({ directoryReferenceEffect }) => {
return executeHtml(`${buildServer.origin}/main.html`);
};

await snapshotBuildTests(import.meta.url, ({ test }) => {
test("0_error", () =>
run({
directoryReferenceEffect: "error",
}));
test("1_copy", () =>
run({
directoryReferenceEffect: "copy",
}));
});
await snapshotBuildTests(
import.meta.url,
({ test }) => {
test("0_error", () =>
run({
directoryReferenceEffect: "error",
}));
test("1_copy", () =>
run({
directoryReferenceEffect: "copy",
}));
},
{ executionEffects: { catch: true } },
);
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# [0_basic](../../css_background_url_build.test.mjs#L5)
# [0_basic](../../css_background_url_build.test.mjs#L15)

```js
build({
sourceDirectoryUrl: new URL("./client/", import.meta.url),
buildDirectoryUrl: new URL("./build/", import.meta.url),
entryPoints: { "./main.css": "main.css" },
bundling: false,
minification: false,
})
run()
```

# 1/2 write 2 files into "./build/"
Expand All @@ -17,7 +11,7 @@ see [./build/](./build/)
# 2/2 resolve

```js
{}
undefined
```

---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { build } from "@jsenv/core";
import { snapshotBuildTests } from "@jsenv/core/tests/snapshot_build_side_effects.js";

const run = async () => {
await build({
sourceDirectoryUrl: new URL("./client/", import.meta.url),
buildDirectoryUrl: new URL("./build/", import.meta.url),
entryPoints: { "./main.css": "main.css" },
bundling: false,
minification: false,
});
};

await snapshotBuildTests(import.meta.url, ({ test }) => {
test("0_basic", () =>
build({
sourceDirectoryUrl: new URL("./client/", import.meta.url),
buildDirectoryUrl: new URL("./build/", import.meta.url),
entryPoints: { "./main.css": "main.css" },
bundling: false,
minification: false,
}));
test("0_basic", () => run());
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [0_basic](../../css_background_url_not_found_build.test.mjs#L20)
# [0_basic](../../css_background_url_not_found_build.test.mjs#L22)

```js
run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const run = async () => {
return executeHtml(`${buildServer.origin}/main.html`);
};

await snapshotBuildTests(import.meta.url, ({ test }) => {
test("0_basic", () => run());
});
await snapshotBuildTests(
import.meta.url,
({ test }) => {
test("0_basic", () => run());
},
{ executionEffects: { catch: true } },
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [0_basic](../../img_not_found_build.test.mjs#L20)
# [0_basic](../../img_not_found_build.test.mjs#L22)

```js
run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const run = async () => {
return executeHtml(`${buildServer.origin}/main.html`);
};

await snapshotBuildTests(import.meta.url, ({ test }) => {
test("0_basic", () => run());
});
await snapshotBuildTests(
import.meta.url,
({ test }) => {
test("0_basic", () => run());
},
{ executionEffects: { catch: true } },
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [0_basic](../../js_import_meta_url_not_found_build.test.mjs#L20)
# [0_basic](../../js_import_meta_url_not_found_build.test.mjs#L22)

```js
run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const run = async () => {
return executeHtml(`${buildServer.origin}/main.html`);
};

await snapshotBuildTests(import.meta.url, ({ test }) => {
test("0_basic", () => run());
});
await snapshotBuildTests(
import.meta.url,
({ test }) => {
test("0_basic", () => run());
},
{
executionEffects: { catch: true },
},
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [0_basic](../../js_import_not_found_build.test.mjs#L20)
# [0_basic](../../js_import_not_found_build.test.mjs#L22)

```js
run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const run = async () => {
return executeHtml(`${buildServer.origin}/main.html`);
};

await snapshotBuildTests(import.meta.url, ({ test }) => {
test("0_basic", () => run());
});
await snapshotBuildTests(
import.meta.url,
({ test }) => {
test("0_basic", () => run());
},
{
executionEffects: { catch: true },
},
);

0 comments on commit af87b0e

Please sign in to comment.