From 084e9f87b345d7e79db9be88042a8cf924b7e34c Mon Sep 17 00:00:00 2001 From: Corinne PAULVE Date: Tue, 17 Dec 2024 12:40:41 +0100 Subject: [PATCH] fix: the tsconfig spec generated for library contains several issues --- .../workspace/schematics/index.it.spec.ts | 10 ++++ .../schematics/library/index.spec.ts | 52 +++++++++++++++++-- .../schematics/library/rules/rules.ng.ts | 38 ++++++++++++-- .../schematics/library/rules/rules.nx.ts | 30 +++++++++-- .../schematics/library/rules/shared.ts | 49 ++++++++++++++--- .../{ng => jest}/jest.config.js.template | 0 .../testing/setup-jest.ts.template | 0 .../ng/{ => common}/.gitignore.template | 0 .../ng/{ => common}/.npmignore.template | 0 .../tsconfig.builders.json.template | 0 .../ng/{ => common}/tsconfig.json.template | 0 .../tsconfig.build.composite.json.template | 6 +++ .../ng/{ => jest}/tsconfig.spec.json.template | 2 +- .../templates/nx/jest.config.js.template | 38 -------------- .../nx/testing/setup-jest.ts.template | 2 - .../new-version/packaged-action/LICENSE.txt | 27 ++++++++++ 16 files changed, 193 insertions(+), 61 deletions(-) rename packages/@o3r/workspace/schematics/library/templates/{ng => jest}/jest.config.js.template (100%) rename packages/@o3r/workspace/schematics/library/templates/{ng => jest}/testing/setup-jest.ts.template (100%) rename packages/@o3r/workspace/schematics/library/templates/ng/{ => common}/.gitignore.template (100%) rename packages/@o3r/workspace/schematics/library/templates/ng/{ => common}/.npmignore.template (100%) rename packages/@o3r/workspace/schematics/library/templates/ng/{ => common}/tsconfig.builders.json.template (100%) rename packages/@o3r/workspace/schematics/library/templates/ng/{ => common}/tsconfig.json.template (100%) create mode 100644 packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.build.composite.json.template rename packages/@o3r/workspace/schematics/library/templates/ng/{ => jest}/tsconfig.spec.json.template (92%) delete mode 100644 packages/@o3r/workspace/schematics/library/templates/nx/jest.config.js.template delete mode 100644 packages/@o3r/workspace/schematics/library/templates/nx/testing/setup-jest.ts.template diff --git a/packages/@o3r/workspace/schematics/index.it.spec.ts b/packages/@o3r/workspace/schematics/index.it.spec.ts index bcc0750764..487dd5ec0c 100644 --- a/packages/@o3r/workspace/schematics/index.it.spec.ts +++ b/packages/@o3r/workspace/schematics/index.it.spec.ts @@ -13,6 +13,7 @@ import * as path from 'node:path'; import { getDefaultExecSyncOptions, getGitDiff, + getPackageManager, packageManagerExec, packageManagerInstall, packageManagerRun, @@ -95,6 +96,10 @@ describe('new otter workspace', () => { const execAppOptions = { ...getDefaultExecSyncOptions(), cwd: workspacePath }; const libName = 'test-library'; const inLibraryPath = path.resolve(workspacePath, 'libs', libName); + // TODO Remove node-linker once https://github.com/AmadeusITGroup/otter/issues/2620 is completed + if (getPackageManager() === 'yarn') { + packageManagerExec({ script: 'config', args: ['set', 'nodeLinker', 'node-modules'] }, execAppOptions); + } expect(() => packageManagerInstall(execAppOptions)).not.toThrow(); const generatedLibFiles = [ @@ -115,6 +120,7 @@ describe('new otter workspace', () => { expect(existsSync(path.join(workspacePath, 'project'))).toBe(false); generatedLibFiles.forEach((file) => expect(existsSync(path.join(inLibraryPath, file))).toBe(true)); expect(() => packageManagerRunOnProject(libName, true, { script: 'build' }, execAppOptions)).not.toThrow(); + expect(() => packageManagerExec({ script: 'ng', args: ['test', '--watch=false', '--browsers=ChromeHeadless'] }, execAppOptions)).not.toThrow(); }); test('should generate a monorepo setup', async () => { @@ -122,6 +128,10 @@ describe('new otter workspace', () => { const defaultOptions = getDefaultExecSyncOptions(); const execAppOptions = { ...defaultOptions, cwd: workspacePath, env: { ...defaultOptions.env, NX_CLOUD_ACCESS_TOKEN: '' } }; + // TODO Remove node-linker once https://github.com/AmadeusITGroup/otter/issues/2620 is completed + if (getPackageManager() === 'yarn') { + packageManagerExec({ script: 'config', args: ['set', 'nodeLinker', 'node-modules'] }, execAppOptions); + } expect(() => packageManagerInstall(execAppOptions)).not.toThrow(); const rootPackageJson = JSON.parse(await fs.readFile(path.join(workspacePath, 'package.json'), 'utf8')) as PackageJson; expect(rootPackageJson.scripts).toHaveProperty('build', 'lerna run build'); diff --git a/packages/@o3r/workspace/schematics/library/index.spec.ts b/packages/@o3r/workspace/schematics/library/index.spec.ts index e8ea8ad7e0..cee335521e 100644 --- a/packages/@o3r/workspace/schematics/library/index.spec.ts +++ b/packages/@o3r/workspace/schematics/library/index.spec.ts @@ -17,6 +17,15 @@ jest.mock('@angular-devkit/schematics', () => { }); const collectionPath = path.join(__dirname, '..', '..', 'collection.json'); +const angularJsonFile = `{ + "version": 1, + "projects": { + "my-new-module": { + "projectType": "library", + "root": "packages-test/my-new-module" + } + } +}`; describe('New module generator', () => { let initialTree: Tree; @@ -36,7 +45,7 @@ describe('New module generator', () => { }); it('should generate the minimum mandatory files', async () => { - initialTree.create('angular.json', '{"version": 1, "projects": {} }'); + initialTree.create('angular.json', angularJsonFile); initialTree.create('package.json', '{ "version": "0.0.0-test" }'); initialTree.create('/packages-test/my-new-module/package.json', '{ "version": "0.0.0-test" }'); initialTree.create('/packages-test/my-new-module/ng-package.json', '{ }'); @@ -58,11 +67,42 @@ describe('New module generator', () => { expect(tree.exists('/packages-test/my-new-module/project.json')).toBe(false); expect(JSON.parse(tree.readContent('/tsconfig.base.json')).compilerOptions.paths['@my/new-module']).toContain('packages-test/my-new-module/src/public-api'); expect(JSON.parse(tree.readContent('/tsconfig.build.json')).compilerOptions.paths['@my/new-module'][0]).toBe('packages-test/my-new-module/dist'); + expect(tree.exists('/packages-test/my-new-module/testing/setup-jest.ts')).toBe(false); + expect(JSON.parse(tree.readContent('/packages-test/my-new-module/package.json')).scripts.test).toContain('ng test my-new-module'); + expect(tree.exists('/packages-test/my-new-module/jest.config.js')).toBe(false); expect(tree.files.length).toBeGreaterThanOrEqual(9); }); - // eslint-disable-next-line jest/no-disabled-tests -- TODO: Should be re-enable when the following issue #2066 is fixed - describe.skip('in NX monorepo', () => { + it('should generate an project with jest files', async () => { + initialTree.create('angular.json', angularJsonFile); + initialTree.create('package.json', '{ "version": "0.0.0-test" }'); + initialTree.create('/packages-test/my-new-module/package.json', '{ "version": "0.0.0-test" }'); + initialTree.create('/packages-test/my-new-module/ng-package.json', '{ }'); + const runner = new SchematicTestRunner('schematics', collectionPath); + const angularPackageJson = require.resolve('@schematics/angular/package.json'); + const o3rCorePackageJson = require.resolve('@o3r/core/package.json'); + runner.registerCollection('@o3r/core', path.resolve(path.dirname(o3rCorePackageJson), require(o3rCorePackageJson).schematics)); + runner.registerCollection('@schematics/angular', path.resolve(path.dirname(angularPackageJson), require(angularPackageJson).schematics)); + jest.spyOn(require('@angular-devkit/schematics'), 'externalSchematic'); + const tree = await runner.runSchematic('library', { + path: 'packages-test', + name: '@my/new-module', + skipLinter: true, + skipInstall: true, + testingFramework: 'jest' + + }, initialTree); + expect(tree.exists('/packages-test/my-new-module/testing/setup-jest.ts')).toBe(true); + expect(tree.exists('/packages-test/my-new-module/jest.config.js')).toBe(true); + expect(JSON.parse(tree.readContent('/packages-test/my-new-module/package.json')).scripts.test).toContain('jest'); + (tree.readJson('/packages-test/my-new-module/tsconfig.spec.json') as { references: { path: string }[] }) + .references + .forEach((ref) => { + expect(tree.exists(path.join('/packages-test/my-new-module', ref.path))).toBe(true); + }); + }); + + describe('in NX monorepo', () => { it('should generate Nx project.json with given name', async () => { initialTree.create('nx.json', '{"workspaceLayout": { "libsDir": "packages-test" } }'); initialTree.create('angular.json', '{"version": 1, "projects": {} }'); @@ -77,14 +117,16 @@ describe('New module generator', () => { runner.registerCollection('@schematics/angular', path.resolve(path.dirname(angularPackageJson), require(angularPackageJson).schematics)); runner.registerCollection('@nx/workspace', path.resolve(path.dirname(nxWorkspacePackageJson), require(nxWorkspacePackageJson).generators)); const tree = await runner.runExternalSchematic('schematics', 'library', { - path: 'packages-test', name: '@my/new-module', projectName: 'test-module-name', skipLinter: true }, initialTree); expect(tree.exists('/packages-test/my-new-module/project.json')).toBe(true); - expect(tree.readContent('/packages-test/my-new-module/project.json')).toContain('"name": "test-module-name"'); + const projectJson: any = tree.readJson('/packages-test/my-new-module/project.json'); + expect(projectJson.name).toBe('test-module-name'); + expect(tree.exists(projectJson.targets.test.options.jestConfig)).toBe(true); + expect(projectJson.targets.test.executor).toBe('@nrwl/jest:jest'); }); }); }); diff --git a/packages/@o3r/workspace/schematics/library/rules/rules.ng.ts b/packages/@o3r/workspace/schematics/library/rules/rules.ng.ts index 6384dd4447..fa17bc85c0 100644 --- a/packages/@o3r/workspace/schematics/library/rules/rules.ng.ts +++ b/packages/@o3r/workspace/schematics/library/rules/rules.ng.ts @@ -28,6 +28,8 @@ import type { NgGenerateModuleSchema, } from '../schema'; import { + setUpAngularTestPackageJson, + setUpJestOnPackageJson, updateNgPackagrFactory, updatePackageDependenciesFactory, } from './shared'; @@ -50,21 +52,47 @@ export function ngGenerateModule(options: NgGenerateModuleSchema & { targetPath: const o3rCorePackageJson: PackageJson & { generatorDependencies?: Record } = JSON.parse(readFileSync(o3rCorePackageJsonPath).toString()); const otterVersion = o3rCorePackageJson.dependencies!['@o3r/schematics']; - const templateNg = apply(url('./templates/ng'), [ + const templateNg = apply(url('./templates/ng/common'), [ template({ ...options, - tsconfigSpecPath: findConfigFileRelativePath(tree, - ['tsconfig.test.json', 'tsconfig.spec.json', 'tsconfig.jest.json', 'tsconfig.jasmine.json', 'tsconfig.base.json', 'tsconfig.json'], options.targetPath), tsconfigBasePath: findConfigFileRelativePath(tree, ['tsconfig.base.json', 'tsconfig.json'], options.targetPath), tsconfigBuildPath: findConfigFileRelativePath(tree, ['tsconfig.build.json', 'tsconfig.base.json', 'tsconfig.json'], options.targetPath) }), renameTemplateFiles(), move(options.targetPath) ]); - + const templateCommonJest = apply(url('./templates/jest'), [ + template({ + ...options, + tsconfigBasePath: findConfigFileRelativePath(tree, ['tsconfig.base.json', 'tsconfig.json'], options.targetPath) + }), + renameTemplateFiles(), + move(options.targetPath) + ]); + const templateNgJest = apply(url('./templates/ng/jest'), [ + template({ + ...options, + tsconfigSpecPath: findConfigFileRelativePath(tree, + ['tsconfig.test.json', 'tsconfig.spec.json', 'tsconfig.jest.json', 'tsconfig.jasmine.json', 'tsconfig.base.json', 'tsconfig.json'], options.targetPath), + tsconfigBasePath: findConfigFileRelativePath(tree, ['tsconfig.base.json', 'tsconfig.json'], options.targetPath) + }), + renameTemplateFiles(), + move(options.targetPath) + ]); + const packageJsonContent = tree.readText('/package.json'); + const hasJestInstalled = options.testingFramework === 'jest' || packageJsonContent.match('jest'); return chain([ mergeWith(templateNg, MergeStrategy.Overwrite), - updatePackageDependenciesFactory(options.targetPath, otterVersion!, o3rCorePackageJson, options), + ...hasJestInstalled + ? [ + mergeWith(templateCommonJest, MergeStrategy.Overwrite), + mergeWith(templateNgJest, MergeStrategy.Overwrite), + setUpJestOnPackageJson(options) + ] + : [ + setUpAngularTestPackageJson(options) + ], + updatePackageDependenciesFactory(options.targetPath, otterVersion!, o3rCorePackageJson, { ...options, useJest: !!hasJestInstalled }), updateNgPackagrFactory(options.targetPath), (t) => { const genPackageJsonPath = path.posix.join(options.targetPath, 'package.json'); diff --git a/packages/@o3r/workspace/schematics/library/rules/rules.nx.ts b/packages/@o3r/workspace/schematics/library/rules/rules.nx.ts index 7675ea7368..209afc11af 100644 --- a/packages/@o3r/workspace/schematics/library/rules/rules.nx.ts +++ b/packages/@o3r/workspace/schematics/library/rules/rules.nx.ts @@ -88,6 +88,21 @@ export function nxGenerateModule(options: NgGenerateModuleSchema & { packageJson return path.posix.join(workspaceLayout.libsDir, options.name); }; + const setUpJestOnProjectJson = (tree: Tree) => { + // const projectJsonContent = tree.readJson(`${options.targetPath}/project.json`) as { targets: any }; + // projectJsonContent.targets ||= {}; + // projectJsonContent.targets.test = { + // test: { + // executor: '@nx/jest:jest', + // options: { + // jestConfig: `${options.targetPath}/jest.config.js` + // } + // } + // }; + // tree.overwrite(`${options.targetPath}/project.json`, JSON.stringify(projectJsonContent, null, 2)); + return tree; + }; + /** * Update Nx templates * @param tree File tree @@ -105,12 +120,11 @@ export function nxGenerateModule(options: NgGenerateModuleSchema & { packageJson const o3rCorePackageJsonPath = path.resolve(__dirname, '..', '..', '..', 'package.json'); const o3rCorePackageJson: PackageJson & { generatorDependencies?: Record } = JSON.parse(readFileSync(o3rCorePackageJsonPath).toString()); const otterVersion = o3rCorePackageJson.dependencies!['@o3r/schematics']; - const templateNx = apply(url('./templates/nx'), [ template({ ...options, path: targetPath, - projectRoot: path.posix.resolve(targetPath, options.name), + projectRoot: targetPath, otterVersion, tsconfigBasePath: findConfigFileRelativePath(tree, ['tsconfig.base.json', 'tsconfig.json'], targetPath), runner: getPackageManagerRunner(getWorkspaceConfig(tree)) @@ -118,12 +132,22 @@ export function nxGenerateModule(options: NgGenerateModuleSchema & { packageJson renameTemplateFiles(), move(targetPath) ]); + const templateJest = apply(url('./templates/jest'), [ + template({ + ...options, + tsconfigBasePath: findConfigFileRelativePath(tree, ['tsconfig.base.json', 'tsconfig.json'], targetPath) + }), + renameTemplateFiles(), + move(targetPath) + ]); rules.push(mergeWith(templateNx, MergeStrategy.Overwrite)); return chain([ ...rules, - updatePackageDependenciesFactory(targetPath, otterVersion!, o3rCorePackageJson, options), + updatePackageDependenciesFactory(targetPath, otterVersion!, o3rCorePackageJson, { ...options, useJest: true }), updateNgPackagrFactory(targetPath), + mergeWith(templateJest, MergeStrategy.Overwrite), + setUpJestOnProjectJson, (t) => { const packageJson = t.readJson(path.posix.join(targetPath, 'package.json')) as PackageJson; packageJson.name = options.packageJsonName; diff --git a/packages/@o3r/workspace/schematics/library/rules/shared.ts b/packages/@o3r/workspace/schematics/library/rules/shared.ts index 9a985dd3de..9c9246c5e7 100644 --- a/packages/@o3r/workspace/schematics/library/rules/shared.ts +++ b/packages/@o3r/workspace/schematics/library/rules/shared.ts @@ -1,6 +1,7 @@ import * as path from 'node:path'; import type { Rule, + Tree, } from '@angular-devkit/schematics'; import { enforceTildeRange, @@ -14,6 +15,36 @@ import { NgGenerateModuleSchema, } from '../schema'; +/** + * Set jest files and script in the generated library. + * @param options + */ +export function setUpJestOnPackageJson(options: NgGenerateModuleSchema & { targetPath: string }) { + return (tree: Tree) => { + const packageJsonPath = path.join(options.targetPath, 'package.json'); + const packageJsonContent = tree.readJson(packageJsonPath) as PackageJson; + packageJsonContent.scripts ||= {}; + packageJsonContent.scripts.test ||= 'jest'; + tree.overwrite(packageJsonPath, JSON.stringify(packageJsonContent, null, 2)); + return tree; + }; +} + +/** + * Set jest files and script in the generated library. + * @param options + */ +export function setUpAngularTestPackageJson(options: NgGenerateModuleSchema & { targetPath: string }) { + return (tree: Tree) => { + const packageJsonPath = path.join(options.targetPath, 'package.json'); + const packageJsonContent = tree.readJson(packageJsonPath) as PackageJson; + packageJsonContent.scripts ||= {}; + packageJsonContent.scripts.test ||= `ng test ${options.name}`; + tree.overwrite(packageJsonPath, JSON.stringify(packageJsonContent, null, 2)); + return tree; + }; +} + /** * Generate rule to update generated package.json file * @param targetPath Path of the generated files @@ -25,7 +56,7 @@ export function updatePackageDependenciesFactory( targetPath: string, otterVersion: string, o3rCorePackageJson: PackageJson & { generatorDependencies?: Record }, - options: NgGenerateModuleSchema): Rule { + options: NgGenerateModuleSchema & { useJest?: boolean }): Rule { return (tree) => { const packageJson = tree.readJson(path.posix.join(targetPath, 'package.json')) as PackageJson; const runner = getPackageManagerRunner(getWorkspaceConfig(tree)); @@ -56,20 +87,24 @@ export function updatePackageDependenciesFactory( '@angular/platform-browser': packageJson.peerDependencies['@angular/common'], '@angular/platform-browser-dynamic': packageJson.peerDependencies['@angular/common'], '@schematics/angular': o3rCorePackageJson.peerDependencies!['@schematics/angular'], - '@types/jest': o3rCorePackageJson.generatorDependencies!['@types/jest'], '@typescript-eslint/eslint-plugin': o3rCorePackageJson.generatorDependencies!['@typescript-eslint/parser'], '@typescript-eslint/parser': o3rCorePackageJson.generatorDependencies!['@typescript-eslint/parser'], 'cpy-cli': o3rCorePackageJson.generatorDependencies!['cpy-cli'], eslint: o3rCorePackageJson.generatorDependencies!.eslint, 'eslint-import-resolver-node': o3rCorePackageJson.generatorDependencies!['eslint-import-resolver-node'], - 'eslint-plugin-jest': o3rCorePackageJson.generatorDependencies!['eslint-plugin-jest'], + ...options.useJest + ? { + '@types/jest': o3rCorePackageJson.generatorDependencies!['@types/jest'], + 'eslint-plugin-jest': o3rCorePackageJson.generatorDependencies!['eslint-plugin-jest'], + jest: o3rCorePackageJson.generatorDependencies!.jest, + 'jest-environment-jsdom': o3rCorePackageJson.generatorDependencies!.jest, + 'jest-junit': o3rCorePackageJson.generatorDependencies!['jest-junit'], + 'jest-preset-angular': o3rCorePackageJson.generatorDependencies!['jest-preset-angular'] + } + : {}, 'eslint-plugin-jsdoc': o3rCorePackageJson.generatorDependencies!['eslint-plugin-jsdoc'], 'eslint-plugin-prefer-arrow': o3rCorePackageJson.generatorDependencies!['eslint-plugin-prefer-arrow'], 'eslint-plugin-unicorn': o3rCorePackageJson.generatorDependencies!['eslint-plugin-unicorn'], - jest: o3rCorePackageJson.generatorDependencies!.jest, - 'jest-environment-jsdom': o3rCorePackageJson.generatorDependencies!.jest, - 'jest-junit': o3rCorePackageJson.generatorDependencies!['jest-junit'], - 'jest-preset-angular': o3rCorePackageJson.generatorDependencies!['jest-preset-angular'], rxjs: o3rCorePackageJson.peerDependencies!.rxjs, typescript: o3rCorePackageJson.peerDependencies!.typescript, 'zone.js': o3rCorePackageJson.generatorDependencies!['zone.js'] diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/jest.config.js.template b/packages/@o3r/workspace/schematics/library/templates/jest/jest.config.js.template similarity index 100% rename from packages/@o3r/workspace/schematics/library/templates/ng/jest.config.js.template rename to packages/@o3r/workspace/schematics/library/templates/jest/jest.config.js.template diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/testing/setup-jest.ts.template b/packages/@o3r/workspace/schematics/library/templates/jest/testing/setup-jest.ts.template similarity index 100% rename from packages/@o3r/workspace/schematics/library/templates/ng/testing/setup-jest.ts.template rename to packages/@o3r/workspace/schematics/library/templates/jest/testing/setup-jest.ts.template diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/.gitignore.template b/packages/@o3r/workspace/schematics/library/templates/ng/common/.gitignore.template similarity index 100% rename from packages/@o3r/workspace/schematics/library/templates/ng/.gitignore.template rename to packages/@o3r/workspace/schematics/library/templates/ng/common/.gitignore.template diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/.npmignore.template b/packages/@o3r/workspace/schematics/library/templates/ng/common/.npmignore.template similarity index 100% rename from packages/@o3r/workspace/schematics/library/templates/ng/.npmignore.template rename to packages/@o3r/workspace/schematics/library/templates/ng/common/.npmignore.template diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.builders.json.template b/packages/@o3r/workspace/schematics/library/templates/ng/common/tsconfig.builders.json.template similarity index 100% rename from packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.builders.json.template rename to packages/@o3r/workspace/schematics/library/templates/ng/common/tsconfig.builders.json.template diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.json.template b/packages/@o3r/workspace/schematics/library/templates/ng/common/tsconfig.json.template similarity index 100% rename from packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.json.template rename to packages/@o3r/workspace/schematics/library/templates/ng/common/tsconfig.json.template diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.build.composite.json.template b/packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.build.composite.json.template new file mode 100644 index 0000000000..75989c2388 --- /dev/null +++ b/packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.build.composite.json.template @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "composite": true + } +} diff --git a/packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.spec.json.template b/packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.spec.json.template similarity index 92% rename from packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.spec.json.template rename to packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.spec.json.template index 4dba869bbf..ab6b0e6f18 100644 --- a/packages/@o3r/workspace/schematics/library/templates/ng/tsconfig.spec.json.template +++ b/packages/@o3r/workspace/schematics/library/templates/ng/jest/tsconfig.spec.json.template @@ -3,7 +3,7 @@ "compilerOptions": { "composite": true, "outDir": "test", - "rootDir": ".", + "rootDir": "." }, "include": [ "./src/**/*.spec.ts" diff --git a/packages/@o3r/workspace/schematics/library/templates/nx/jest.config.js.template b/packages/@o3r/workspace/schematics/library/templates/nx/jest.config.js.template deleted file mode 100644 index b983a234bc..0000000000 --- a/packages/@o3r/workspace/schematics/library/templates/nx/jest.config.js.template +++ /dev/null @@ -1,38 +0,0 @@ -const { pathsToModuleNameMapper } = require('ts-jest'); -const { compilerOptions } = require('<%= tsconfigBasePath %>'); - -globalThis.ngJest = { - skipNgcc: true -}; - -/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ -module.exports = { - displayName: require('./package.json').name, - preset: 'jest-preset-angular', - setupFilesAfterEnv: ['/testing/setup-jest.ts'], - rootDir: '.', - moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths), - testPathIgnorePatterns: [ - '/dist', - ], - reporters: [ - 'default', - 'github-actions' - ], - globalSetup: 'jest-preset-angular/global-setup', - transform: { - // eslint-disable-next-line @typescript-eslint/naming-convention - '^.+\\.tsx?$': [ - 'jest-preset-angular', - { - tsconfig: '/tsconfig.spec.json', - stringifyContentPathRegex: '\\.html$' - } - ] - }, - snapshotSerializers: [ - 'jest-preset-angular/build/serializers/no-ng-attributes', - 'jest-preset-angular/build/serializers/ng-snapshot', - 'jest-preset-angular/build/serializers/html-comment', - ] -}; diff --git a/packages/@o3r/workspace/schematics/library/templates/nx/testing/setup-jest.ts.template b/packages/@o3r/workspace/schematics/library/templates/nx/testing/setup-jest.ts.template deleted file mode 100644 index ab68e1eb87..0000000000 --- a/packages/@o3r/workspace/schematics/library/templates/nx/testing/setup-jest.ts.template +++ /dev/null @@ -1,2 +0,0 @@ -import 'jest-preset-angular/setup-jest'; - diff --git a/tools/github-actions/new-version/packaged-action/LICENSE.txt b/tools/github-actions/new-version/packaged-action/LICENSE.txt index 7ee631dd7c..4ec329636a 100644 --- a/tools/github-actions/new-version/packaged-action/LICENSE.txt +++ b/tools/github-actions/new-version/packaged-action/LICENSE.txt @@ -94,6 +94,33 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @o3r/new-version +Copyright Amadeus SAS + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + @octokit/auth-token MIT