chore(js): update js plugin unit tests to use "as-provided" option when generating apps/libs (#18894)
This commit is contained in:
parent
da2a08e575
commit
74c812e2e8
@ -22,9 +22,9 @@ describe('convert to swc', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
tree = createTreeWithEmptyWorkspace();
|
||||||
tree.write('/apps/.gitignore', '');
|
tree.write('/.gitignore', '');
|
||||||
tree.write('/libs/.gitignore', '');
|
tree.write('/.gitignore', '');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should convert tsc to swc', async () => {
|
it('should convert tsc to swc', async () => {
|
||||||
@ -32,6 +32,7 @@ describe('convert to swc', () => {
|
|||||||
...defaultLibGenerationOptions,
|
...defaultLibGenerationOptions,
|
||||||
name: 'tsc-lib',
|
name: 'tsc-lib',
|
||||||
bundler: 'tsc',
|
bundler: 'tsc',
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@ -49,7 +50,7 @@ describe('convert to swc', () => {
|
|||||||
)
|
)
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
expect(tree.read('package.json', 'utf-8')).toContain('@swc/core');
|
expect(tree.read('package.json', 'utf-8')).toContain('@swc/core');
|
||||||
expect(tree.read('libs/tsc-lib/package.json', 'utf-8')).toContain(
|
expect(tree.read('tsc-lib/package.json', 'utf-8')).toContain(
|
||||||
'@swc/helpers'
|
'@swc/helpers'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -23,13 +23,13 @@ if (swcJestConfig.swcrc === undefined) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
displayName: 'my-lib',
|
displayName: 'my-lib',
|
||||||
preset: '../../jest.preset.js',
|
preset: '../jest.preset.js',
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
'^.+\\\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
coverageDirectory: '../../coverage/libs/my-lib',
|
coverageDirectory: '../coverage/my-lib',
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -18,14 +18,14 @@ describe('explicitly-set-projects-to-update-buildable-deps migration', () => {
|
|||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
tree = createTreeWithEmptyWorkspace();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(['@nx/js:swc', '@nrwl/js:swc', '@nx/js:tsc', '@nrwl/js:tsc'])(
|
it.each(['@nx/js:swc', '@nrwl/js:swc', '@nx/js:tsc', '@nrwl/js:tsc'])(
|
||||||
'should set updateBuildableProjectDepsInPackageJson option to "true" when not specified in target using "%s"',
|
'should set updateBuildableProjectDepsInPackageJson option to "true" when not specified in target using "%s"',
|
||||||
async (executor) => {
|
async (executor) => {
|
||||||
addProject(tree, 'lib1', {
|
addProject(tree, 'lib1', {
|
||||||
root: 'libs/lib1',
|
root: 'lib1',
|
||||||
projectType: 'library',
|
projectType: 'library',
|
||||||
targets: { build: { executor, options: {} } },
|
targets: { build: { executor, options: {} } },
|
||||||
});
|
});
|
||||||
@ -43,7 +43,7 @@ describe('explicitly-set-projects-to-update-buildable-deps migration', () => {
|
|||||||
'should set updateBuildableProjectDepsInPackageJson option to "true" when target has no options object defined using "%s"',
|
'should set updateBuildableProjectDepsInPackageJson option to "true" when target has no options object defined using "%s"',
|
||||||
async (executor) => {
|
async (executor) => {
|
||||||
addProject(tree, 'lib1', {
|
addProject(tree, 'lib1', {
|
||||||
root: 'libs/lib1',
|
root: 'lib1',
|
||||||
projectType: 'library',
|
projectType: 'library',
|
||||||
targets: { build: { executor } },
|
targets: { build: { executor } },
|
||||||
});
|
});
|
||||||
@ -61,7 +61,7 @@ describe('explicitly-set-projects-to-update-buildable-deps migration', () => {
|
|||||||
'should not overwrite updateBuildableProjectDepsInPackageJson option when it is specified in target using "%s"',
|
'should not overwrite updateBuildableProjectDepsInPackageJson option when it is specified in target using "%s"',
|
||||||
async (executor) => {
|
async (executor) => {
|
||||||
addProject(tree, 'lib1', {
|
addProject(tree, 'lib1', {
|
||||||
root: 'libs/lib1',
|
root: 'lib1',
|
||||||
projectType: 'library',
|
projectType: 'library',
|
||||||
targets: {
|
targets: {
|
||||||
build: {
|
build: {
|
||||||
@ -82,7 +82,7 @@ describe('explicitly-set-projects-to-update-buildable-deps migration', () => {
|
|||||||
|
|
||||||
it('should not update targets using other executors', async () => {
|
it('should not update targets using other executors', async () => {
|
||||||
const originalProjectConfig: ProjectConfiguration = {
|
const originalProjectConfig: ProjectConfiguration = {
|
||||||
root: 'libs/lib1',
|
root: 'lib1',
|
||||||
projectType: 'library',
|
projectType: 'library',
|
||||||
targets: {
|
targets: {
|
||||||
build: {
|
build: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user