Skip to content

Commit

Permalink
migrate 2 more test and godo for now
Browse files Browse the repository at this point in the history
  • Loading branch information
dmail committed Jul 25, 2024
1 parent 085c2cf commit d86177e
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 40 deletions.
37 changes: 17 additions & 20 deletions tests/node_esm/dev_and_prod/dev_and_prod.test.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import { takeFileSnapshot } from "@jsenv/snapshot";

import { writeImportmaps } from "@jsenv/importmap-node-module";
import { snapshotWriteImportsMapsSideEffects } from "@jsenv/importmap-node-module/tests/snapshot_write_importmaps_side_effects.js";

const testDirectoryUrl = new URL("./root/", import.meta.url);
const devImportmapFileUrl = new URL("./root/dev.importmap", import.meta.url);
const prodImportmapFileUrl = new URL("./root/prod.importmap", import.meta.url);
const devimportmapFileSnapshot = takeFileSnapshot(devImportmapFileUrl);
const prodimportmapFileSnapshot = takeFileSnapshot(prodImportmapFileUrl);
await writeImportmaps({
logLevel: "warn",
directoryUrl: testDirectoryUrl,
importmaps: {
"dev.importmap": {
nodeMappings: {
devDependencies: true,
await snapshotWriteImportsMapsSideEffects(
() =>
writeImportmaps({
logLevel: "warn",
directoryUrl: new URL("./input/", import.meta.url),
importmaps: {
"dev.importmap": {
nodeMappings: {
devDependencies: true,
},
},
"prod.importmap": {},
},
},
"prod.importmap": {},
},
});
devimportmapFileSnapshot.compare();
prodimportmapFileSnapshot.compare();
}),
import.meta.url,
`./output/dev_and_prod.md`,
);
55 changes: 55 additions & 0 deletions tests/node_esm/dev_and_prod/output/dev_and_prod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
1. return promise

2. write file "input/dev.importmap"
```importmap
{
"imports": {
"root/": "./",
"bar/": "./node_modules/bar/",
"foo/": "./node_modules/foo/",
"root": "./index",
"bar": "./node_modules/bar/bar.js",
"foo": "./node_modules/foo/foo.js"
},
"scopes": {}
}
```

3. write file "input/prod.importmap"
```importmap
{
"imports": {
"root/": "./",
"foo/": "./node_modules/foo/",
"root": "./index",
"foo": "./node_modules/foo/foo.js"
},
"scopes": {}
}
```

4. resolve
```js
{
"dev.importmap": {
"imports": {
"root/": "./",
"bar/": "./node_modules/bar/",
"foo/": "./node_modules/foo/",
"root": "./index",
"bar": "./node_modules/bar/bar.js",
"foo": "./node_modules/foo/foo.js"
},
"scopes": {}
},
"prod.importmap": {
"imports": {
"root/": "./",
"foo/": "./node_modules/foo/",
"root": "./index",
"foo": "./node_modules/foo/foo.js"
},
"scopes": {}
}
}
```
11 changes: 0 additions & 11 deletions tests/node_esm/dev_and_prod/root/dev.importmap

This file was deleted.

9 changes: 0 additions & 9 deletions tests/node_esm/dev_and_prod/root/prod.importmap

This file was deleted.

0 comments on commit d86177e

Please sign in to comment.