Skip to content

Commit

Permalink
feat(tests): New @island/testing/e2e library (#16287)
Browse files Browse the repository at this point in the history
* Add @swc-node/register and @swc/core

* Add testing/e2e library

* update project.json for testing/e2e

* fix import for libTestingE2e

---------

Co-authored-by: Kristofer <kristofer@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored and thordurhhh committed Oct 8, 2024
1 parent ea96732 commit 4103df0
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 0 deletions.
18 changes: 18 additions & 0 deletions libs/testing/e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/testing/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# libs/testing/e2e

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test libs/testing/e2e` to execute the unit tests via [Jest](https://jestjs.io).
11 changes: 11 additions & 0 deletions libs/testing/e2e/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'libs/testing/e2e',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../../coverage/libs/testing/e2e',
}
19 changes: 19 additions & 0 deletions libs/testing/e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "testing-e2e",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/testing/e2e/src",
"projectType": "library",
"tags": ["lib:react", "scope:react"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/testing/e2e"],
"options": {
"jestConfig": "libs/testing/e2e/jest.config.ts"
}
}
}
}
1 change: 1 addition & 0 deletions libs/testing/e2e/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/libs/testing/e2e'
7 changes: 7 additions & 0 deletions libs/testing/e2e/src/lib/libs/testing/e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { libsTestingE2e } from './e2e'

describe('libsTestingE2e', () => {
it('should work', () => {
expect(libsTestingE2e()).toEqual('libs/testing/e2e')
})
})
3 changes: 3 additions & 0 deletions libs/testing/e2e/src/lib/libs/testing/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function libsTestingE2e(): string {
return 'libs/testing/e2e'
}
16 changes: 16 additions & 0 deletions libs/testing/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
11 changes: 11 additions & 0 deletions libs/testing/e2e/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}
14 changes: 14 additions & 0 deletions libs/testing/e2e/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@
],
"@island.is/skilavottord/types": ["libs/skilavottord/types/src/index.ts"],
"@island.is/testing/containers": ["libs/testing/containers/src/index.ts"],
"@island.is/testing/e2e": ["libs/testing/e2e/src/index.ts"],
"@island.is/testing/fixtures": ["libs/testing/fixtures/src/index.ts"],
"@island.is/testing/nest": ["libs/testing/nest/src/index.ts"],
"@island.is/university-gateway": ["libs/university-gateway/src/index.ts"],
Expand Down

0 comments on commit 4103df0

Please sign in to comment.