mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
test custom .swcrc and aliases
This commit is contained in:
8
tools/tests/apps/modern/.swcrc
Normal file
8
tools/tests/apps/modern/.swcrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"jsc": {
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@swcAlias/*": ["swcAlias/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
1
tools/tests/apps/modern/server/alias.js
Normal file
1
tools/tests/apps/modern/server/alias.js
Normal file
@@ -0,0 +1 @@
|
||||
import '@swcAlias/main';
|
||||
1
tools/tests/apps/modern/swcAlias/main.js
Normal file
1
tools/tests/apps/modern/swcAlias/main.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log('swcAlias/main.js alias resolved');
|
||||
@@ -70,6 +70,9 @@ selftest.define("modern build stack", async function () {
|
||||
/* check debug stack */
|
||||
await run.match(/server\/main\.js:6:22/, false, true);
|
||||
|
||||
// /* custom .swcrc and alias resolution */
|
||||
// await run.match(/alias resolved/, false, true);
|
||||
|
||||
await run.stop();
|
||||
});
|
||||
|
||||
@@ -219,6 +222,9 @@ selftest.define("modern build stack - transpiler string-like options", async fun
|
||||
run.waitSecs(waitToStart);
|
||||
await run.match("App running at");
|
||||
|
||||
/* custom .swcrc and alias resolution */
|
||||
await run.match(/alias resolved/, false, true);
|
||||
|
||||
/* check transpiler options */
|
||||
await run.match(/\[Transpiler] Used SWC.*\(app\)/, false, true);
|
||||
await run.match(/\[Transpiler] Used SWC.*\(package\)/, false, true);
|
||||
@@ -241,3 +247,40 @@ selftest.define("modern build stack - transpiler string-like options", async fun
|
||||
|
||||
await run.stop();
|
||||
});
|
||||
|
||||
async function writConfig(s, config) {
|
||||
const json = JSON.parse(s.read("package.json"));
|
||||
|
||||
json.meteor = {
|
||||
...json.meteor,
|
||||
...config,
|
||||
};
|
||||
|
||||
s.write("package.json", JSON.stringify(json, null, 2) + "\n");
|
||||
}
|
||||
|
||||
selftest.define("modern build stack - transpiler custom .swcrc", async function () {
|
||||
const s = new Sandbox();
|
||||
await s.init();
|
||||
|
||||
await s.createApp("modern", "modern");
|
||||
await s.cd("modern");
|
||||
|
||||
await writConfig(s, {
|
||||
modern: true,
|
||||
mainModule: {
|
||||
client: 'client/main.js',
|
||||
server: 'server/alias.js',
|
||||
},
|
||||
});
|
||||
|
||||
const run = s.run();
|
||||
|
||||
run.waitSecs(waitToStart);
|
||||
await run.match("App running at");
|
||||
|
||||
/* custom .swcrc and alias resolution */
|
||||
await run.match(/alias resolved/, false, true);
|
||||
|
||||
await run.stop();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user