The Node build module's integration tests supply the SDK the skipped fetch would place (design 47 G §571) #732
@@ -58,17 +58,33 @@ func realMachine(t *testing.T) (*Module, string) {
|
||||
t.Fatalf("the toolchain copied from %s cannot be used: %v", from, err)
|
||||
}
|
||||
for _, id := range []string{"w1", "w2", "w3"} {
|
||||
for p, body := range map[string]string{
|
||||
files := map[string]string{
|
||||
"modules/m/module.json": `{"module":"m","build":{"artifacts":[{"name":"tools","kind":"bundle","language":"typescript","entrypoints":["tools/index.js"]}]}}`,
|
||||
"modules/m/package.json": `{"name":"m","type":"module","scripts":{"test":"node -e \"process.exit(0)\""}}`,
|
||||
"modules/m/tools/index.ts": "import { serveRegisteredOverStdio } from \"@novox/mesh-sdk/stdio\";\nexport const f: () => Promise<void> = serveRegisteredOverStdio as () => Promise<void>;\n",
|
||||
} {
|
||||
}
|
||||
for p, body := range fetchedSDK {
|
||||
files["modules/m/node_modules/@novox/mesh-sdk/"+p] = body
|
||||
}
|
||||
for p, body := range files {
|
||||
write(t, filepath.Join(work, id, "tree", filepath.FromSlash(p)), body, 0o644)
|
||||
}
|
||||
}
|
||||
return m, work
|
||||
}
|
||||
|
||||
// fetchedSDK is the SDK the fixture's workspaces hold where the fetch step places it, in the module's node_modules
|
||||
// (fetch.go, placeSDK: the latest published release, ADR 0573 §2; design 47 G §571), made here because the integration
|
||||
// level has no registry to fetch it from. The toolchain's lock names no SDK since §571, so a fixture that leaves it out
|
||||
// reads one only from a toolchain installed before (main.137 and main.155: TS2307 once a build node installed the
|
||||
// lock). It holds the one export the fixture and the launchers import.
|
||||
var fetchedSDK = map[string]string{
|
||||
"package.json": `{"name":"@novox/mesh-sdk","version":"9.9.9","type":"module",` +
|
||||
`"exports":{"./stdio":{"types":"./dist/stdio.d.ts","default":"./dist/stdio.js"}}}`,
|
||||
"dist/stdio.js": "export async function serveRegisteredOverStdio() {}\n",
|
||||
"dist/stdio.d.ts": "export declare function serveRegisteredOverStdio(): Promise<void>;\n",
|
||||
}
|
||||
|
||||
// 1490/AC2, 1491 and issue 1869, in one test so the toolchain is copied once: the real type-check and test script of the
|
||||
// fixture pass the unit level; a package whose test imports its own build output (as mesh-sdk's do) passes the unit level,
|
||||
// the test step emitting it with the real tsc, shut off, before the test script runs; and the fixture TypeScript bundle
|
||||
|
||||
Reference in New Issue
Block a user