Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ permissions:
actions: read
contents: read

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
main:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"jsxSingleQuote": false,
"printWidth": 80,
"quoteProps": "as-needed",
Expand Down
4 changes: 2 additions & 2 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# path to a directory with all packages
storage: ../build/local-registry/storage
storage: ../dist/local-registry/storage

auth:
htpasswd:
Expand Down Expand Up @@ -41,7 +41,7 @@ packages:
proxy: npmjs

# log settings
logs:
log:
type: stdout
format: pretty
level: warn
Expand Down
22 changes: 22 additions & 0 deletions e2e/bun/.spec.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"jsc": {
"target": "es2017",
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true
},
"keepClassNames": true,
"externalHelpers": true,
"loose": true
},
"module": {
"type": "es6"
},
"sourceMaps": true,
"exclude": []
}
3 changes: 3 additions & 0 deletions e2e/bun/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import baseConfig from '../../eslint.config.mjs';

export default [...baseConfig];
26 changes: 26 additions & 0 deletions e2e/bun/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable */
import { readFileSync } from 'fs';
import type { Config } from 'jest';

// Reading the SWC compilation config for the spec files
const swcJestConfig = JSON.parse(
readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8')
);

// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
swcJestConfig.swcrc = false;

const config: Config = {
detectOpenHandles: false,
displayName: 'bun-e2e',
preset: '../jest.preset.e2e.js',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig]
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: 'test-output/jest/coverage',
globalSetup: '../../tools/scripts/start-local-registry.ts',
globalTeardown: '../../tools/scripts/stop-local-registry.ts'
};

export default config;
5 changes: 5 additions & 0 deletions e2e/bun/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "bun-e2e",
"version": "0.0.1",
"private": true
}
20 changes: 20 additions & 0 deletions e2e/bun/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "bun-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"tags": ["scope:bun", "type:e2e"],
"implicitDependencies": ["bun"],
"projectType": "application",
"sourceRoot": "e2e/bun/src",
"targets": {
"e2e": {
"executor": "@nx/jest:jest",
"inputs": ["e2eInputs"],
"outputs": ["{projectRoot}/test-output/jest/coverage"],
"options": {
"jestConfig": "e2e/bun/jest.config.ts",
"runInBand": true
},
"dependsOn": ["^build"]
}
}
}
77 changes: 77 additions & 0 deletions e2e/bun/src/bun.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { cleanup, ensureNxProject } from '@nx/plugin/testing';
import {
assertPluginInstalled,
generateStonxApp,
getProjectDetails,
installStonxPlugin
} from '@stonx/e2e-utils';

describe('bun', () => {
let bunApp: string;

beforeAll(() => {
ensureNxProject();
installStonxPlugin('bun');
});

afterAll(() => {
cleanup();
});

describe('setup', () => {
it('should be installed', () => {
assertPluginInstalled('bun');
});
});

describe('application generator', () => {
beforeAll(() => {
bunApp = generateStonxApp('bun', '--framework none');
});

it('should properly set up project', () => {
const projectDetails = getProjectDetails(bunApp);

expect(projectDetails).toMatchObject({
name: bunApp,
root: `apps/${bunApp}`,
sourceRoot: `apps/${bunApp}/src`,
projectType: 'application',
targets: {
build: {
executor: '@stonx/bun:build',
inputs: ['production', '^production'],
outputs: ['{options.outputPath}'],
defaultConfiguration: 'production',
options: {
main: `apps/${bunApp}/src/main.ts`,
tsConfig: `apps/${bunApp}/tsconfig.app.json`,
smol: false,
bun: true
},
configurations: {
development: {},
production: {}
},
dependsOn: ['^build']
},
serve: {
continuous: true,
executor: '@stonx/bun:run',
defaultConfiguration: 'development',
options: {
runBuildTargetDependencies: false
},
configurations: {
development: {},
production: {
buildTarget: `${bunApp}:build:production`
}
},
parallelism: true
}
}
});
});
});
});
10 changes: 10 additions & 0 deletions e2e/bun/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.e2e.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.spec.json"
}
]
}
14 changes: 14 additions & 0 deletions e2e/bun/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./out-tsc/jest",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
7 changes: 5 additions & 2 deletions e2e/elysia/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable */
import { readFileSync } from 'fs';
import type { Config } from 'jest';

// Reading the SWC compilation config for the spec files
const swcJestConfig = JSON.parse(
Expand All @@ -9,9 +10,9 @@ const swcJestConfig = JSON.parse(
// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
swcJestConfig.swcrc = false;

export default {
const config: Config = {
displayName: 'elysia-e2e',
preset: '../../jest.preset.js',
preset: '../jest.preset.e2e.js',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig]
},
Expand All @@ -20,3 +21,5 @@ export default {
globalSetup: '../../tools/scripts/start-local-registry.ts',
globalTeardown: '../../tools/scripts/stop-local-registry.ts'
};

export default config;
3 changes: 1 addition & 2 deletions e2e/elysia/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "elysia-e2e",
"version": "0.0.1",
"private": true,
"nx": {}
"private": true
}
58 changes: 23 additions & 35 deletions e2e/elysia/src/elysia.spec.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,41 @@
import { execSync } from 'child_process';
import { cleanup, ensureNxProject } from '@nx/plugin/testing';
import {
cleanupTestProject,
createTestProject,
installPlugin
assertPluginInstalled,
generateStonxApp,
getProjectDetails,
installStonxPlugin
} from '@stonx/e2e-utils';

describe('elysia', () => {
let projectDirectory: string;
let elysiaApp: string;

beforeAll(() => {
projectDirectory = createTestProject();
installPlugin(projectDirectory, 'elysia');
ensureNxProject();
installStonxPlugin('elysia');
});

afterAll(() => {
cleanupTestProject(projectDirectory);
cleanup();
});

it('should be installed', () => {
// npm ls will fail if the package is not installed properly
execSync('pnpm ls --depth 100 @stonx/elysia', {
cwd: projectDirectory,
stdio: 'inherit'
describe('setup', () => {
it('should be installed', () => {
assertPluginInstalled('elysia');
});
});

describe('application generator', () => {
beforeAll(() => {
execSync(
'npx nx g @stonx/elysia:application my-app --linter none --unitTestRunner none --e2eTestRunner none',
{
cwd: projectDirectory,
stdio: 'inherit',
env: process.env
}
);
elysiaApp = generateStonxApp('elysia');
});

it('should infer tasks', () => {
const projectDetails = JSON.parse(
execSync('nx show project my-app --json', {
cwd: projectDirectory
}).toString()
);
it('should properly set up project', () => {
const projectDetails = getProjectDetails(elysiaApp);

expect(projectDetails).toMatchObject({
name: 'my-app',
root: 'my-app',
sourceRoot: 'my-app/src',
name: elysiaApp,
root: `apps/${elysiaApp}`,
sourceRoot: `apps/${elysiaApp}/src`,
projectType: 'application',
targets: {
build: {
Expand All @@ -56,8 +44,8 @@ describe('elysia', () => {
defaultConfiguration: 'production',
options: {
platform: 'node',
main: 'my-app/src/main.ts',
tsConfig: 'my-app/tsconfig.app.json'
main: `apps/${elysiaApp}/src/main.ts`,
tsConfig: `apps/${elysiaApp}/tsconfig.app.json`
},
configurations: {
development: {},
Expand All @@ -81,15 +69,15 @@ describe('elysia', () => {
defaultConfiguration: 'development',
dependsOn: ['build'],
options: {
buildTarget: 'my-app:build',
buildTarget: `${elysiaApp}:build`,
runBuildTargetDependencies: false
},
configurations: {
development: {
buildTarget: 'my-app:build:development'
buildTarget: `${elysiaApp}:build:development`
},
production: {
buildTarget: 'my-app:build:production'
buildTarget: `${elysiaApp}:build:production`
}
},
parallelism: true
Expand Down
9 changes: 9 additions & 0 deletions e2e/jest.preset.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const preset = require('../jest.preset');

// The root preset sets up the environment for unit tests.
delete preset.setupFiles;
delete preset.moduleNameMapper;

module.exports = {
...preset
};
9 changes: 0 additions & 9 deletions e2e/utils/add-plugin.ts

This file was deleted.

12 changes: 0 additions & 12 deletions e2e/utils/cleanup-test-project.ts

This file was deleted.

Loading
Loading