Skip to content

Commit

Permalink
chore(js): add test to check for swc/helpers upon build lib
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed May 20, 2022
1 parent c4a24be commit eae3b97
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion e2e/js/src/js.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
checkFilesDoNotExist,
checkFilesExist,
expectJestTestsToPass,
checkFilesDoNotExist,
newProject,
readFile,
readJson,
Expand Down Expand Up @@ -233,6 +233,31 @@ describe('js e2e', () => {
const output = runCLI(`build ${parentLib}`);
expect(output).toContain('1 task(s) it depends on');
expect(output).toContain('Successfully compiled: 2 files with swc');

updateJson(`libs/${lib}/.lib.swcrc`, (json) => {
json.jsc.externalHelpers = true;
return json;
});

runCLI(`build ${lib}`);

const rootPackageJson = readJson(`package.json`);

expect(readJson(`dist/libs/${lib}/package.json`)).toHaveProperty(
'peerDependencies.@swc/helpers',
rootPackageJson.dependencies['@swc/helpers']
);

updateJson(`libs/${lib}/.lib.swcrc`, (json) => {
json.jsc.externalHelpers = false;
return json;
});

runCLI(`build ${lib}`);

expect(readJson(`dist/libs/${lib}/package.json`)).not.toHaveProperty(
'peerDependencies.@swc/helpers'
);
}, 120000);

it('should not create a `.babelrc` file when creating libs with js executors (--compiler=tsc)', () => {
Expand Down

0 comments on commit eae3b97

Please sign in to comment.