diff --git a/e2e/js/src/js.test.ts b/e2e/js/src/js.test.ts index 0e6911dcf0a581..4d5106b9565115 100644 --- a/e2e/js/src/js.test.ts +++ b/e2e/js/src/js.test.ts @@ -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`); @@ -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 () => {