Skip to content

Commit

Permalink
chore(js): update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gioragutt committed Mar 16, 2022
1 parent 2119fff commit 92585f6
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions e2e/js/src/js.test.ts
Expand Up @@ -34,7 +34,7 @@ describe('js e2e', () => {
});
}, 120000);

fit('should create libs with js executors (--compiler=tsc)', async () => {
it('should create libs with js executors (--compiler=tsc)', async () => {
const lib = uniq('lib');
runCLI(`generate @nrwl/js:lib ${lib} --buildable --compiler=tsc`);
const libPackageJson = readJson(`libs/${lib}/package.json`);
Expand Down Expand Up @@ -127,21 +127,31 @@ describe('js e2e', () => {
expect(output).toContain('1 task(s) it depends on');
expect(output).toContain('Done compiling TypeScript files');

const libWithImportHelpers = uniq('lib-with-import-helpers');
runCLI(
`generate @nrwl/js:lib ${libWithImportHelpers} --buildable --compiler=tsc`
updateJson(`libs/${lib}/tsconfig.json`, (json) => {
json.compilerOptions = { ...json.compilerOptions, importHelpers: true };
return json;
});

runCLI(`build ${lib}`);

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

expect(readJson(`dist/libs/${lib}/package.json`)).toHaveProperty(
'peerDependencies.tslib',
rootPackageJson.dependencies.tslib ??
rootPackageJson.devDependencies.tslib
);

updateJson(`libs/${libWithImportHelpers}/tsconfig.json`, (json) => {
json.compilerOptions = { ...json.compilerOptions, importHelpers: true };
updateJson(`libs/${lib}/tsconfig.json`, (json) => {
json.compilerOptions = { ...json.compilerOptions, importHelpers: false };
return json;
});

runCLI(`build ${libWithImportHelpers}`);
runCLI(`build ${lib}`);

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

it('should create libs with js executors (--compiler=swc)', async () => {
Expand Down

0 comments on commit 92585f6

Please sign in to comment.