Merge branch 'master' of github.com:spotify/backstage into migrate-to-msw
* 'master' of github.com:spotify/backstage: (66 commits) chore: fix lerna linting v0.1.1-alpha.25 Add Code Insights plugin to sample app and marketplace (#2833) Improve main CI build status badge in README (#2866) Update roadmap: Design System 🚢 (#2858) github/codecov: switch to informational mode github/workflows: use the tip of master as the base for comparing PR code coverage make saml provider path from globalConfig (#2855) fix(catalog-backend): limit search value lengths Update project Copyright (#2852) fix(catalog-backend): actually use modified entity output (default namespace was broken) remove unnecessary center keyword Move card header bg to up contrast, fix #2558 Update name of env authentication env vars Fix feedback from dtuite Remove chart testing workflow for now Only lint charts on Pull Requests Move the k8s deployment docs to its own helm deployment page Remove line in initdb script that creates backend db Use app-config.development.yaml to provide configuration instead of local ...
This commit is contained in:
@@ -14,7 +14,7 @@ yarn tsc
|
||||
yarn build
|
||||
```
|
||||
|
||||
Once those tasks have completed, you can now run the test using `yarn start` inside this package.
|
||||
Once those tasks have completed, you can now run the test using `yarn e2e-test run`.
|
||||
|
||||
If you make changes to other packages you will need to rerun `yarn tsc && yarn build`. Changes to this package do not require a rebuild.
|
||||
|
||||
|
||||
Regular → Executable
+6
-2
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
@@ -14,12 +15,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
|
||||
require('ts-node').register({
|
||||
transpileOnly: true,
|
||||
project: require('path').resolve(__dirname, '../../../tsconfig.json'),
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
project: path.resolve(__dirname, '../../../tsconfig.json'),
|
||||
compilerOptions: {
|
||||
module: 'CommonJS',
|
||||
},
|
||||
});
|
||||
|
||||
require('./e2e-test');
|
||||
require('../src');
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "e2e-test",
|
||||
"description": "E2E test for verifying Backstage packages",
|
||||
"version": "0.1.1-alpha.24",
|
||||
"version": "0.1.1-alpha.25",
|
||||
"private": true,
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
@@ -13,17 +13,22 @@
|
||||
"backstage"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "src/index.js",
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"start": "node .",
|
||||
"lint": "backstage-cli lint",
|
||||
"test": "backstage-cli test",
|
||||
"test:e2e": "yarn start"
|
||||
},
|
||||
"bin": {
|
||||
"e2e-test": "bin/e2e-test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli-common": "^0.1.1-alpha.24",
|
||||
"@backstage/cli-common": "^0.1.1-alpha.25",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/node": "^13.7.2",
|
||||
"chalk": "^4.0.0",
|
||||
"commander": "^6.1.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"handlebars": "^4.7.3",
|
||||
"cross-fetch": "^3.0.6",
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CommanderStatic } from 'commander';
|
||||
import { run } from './run';
|
||||
|
||||
export function registerCommands(program: CommanderStatic) {
|
||||
program.command('run').description('Run e2e tests').action(run);
|
||||
}
|
||||
@@ -24,15 +24,15 @@ import Browser from 'zombie';
|
||||
import {
|
||||
spawnPiped,
|
||||
runPlain,
|
||||
handleError,
|
||||
waitForPageWithText,
|
||||
waitFor,
|
||||
waitForExit,
|
||||
print,
|
||||
} from './helpers';
|
||||
} from '../lib/helpers';
|
||||
import pgtools from 'pgtools';
|
||||
import { findPaths } from '@backstage/cli-common';
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
const paths = findPaths(__dirname);
|
||||
|
||||
const templatePackagePaths = [
|
||||
@@ -41,7 +41,7 @@ const templatePackagePaths = [
|
||||
'packages/create-app/templates/default-app/packages/backend/package.json.hbs',
|
||||
];
|
||||
|
||||
async function main() {
|
||||
export async function run() {
|
||||
const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-'));
|
||||
print(`CLI E2E test root: ${rootDir}\n`);
|
||||
|
||||
@@ -412,16 +412,3 @@ async function testBackendStart(appDir: string, isPostgres: boolean) {
|
||||
print('Backend startup test finished successfully');
|
||||
}
|
||||
}
|
||||
|
||||
process.on('unhandledRejection', (error: Error) => {
|
||||
// Try to avoid exiting if the unhandled error is coming from jsdom, i.e. zombie.
|
||||
// Those are typically errors on the page that should be benign, at least in the
|
||||
// context of this test. We have other ways of asserting that the page is being
|
||||
// rendered correctly.
|
||||
if (error?.stack?.includes('node_modules/jsdom/lib')) {
|
||||
console.log(`Ignored error inside jsdom, ${error}`);
|
||||
} else {
|
||||
handleError(error);
|
||||
}
|
||||
});
|
||||
main().catch(handleError);
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import program from 'commander';
|
||||
import chalk from 'chalk';
|
||||
import { registerCommands } from './commands';
|
||||
import { version } from '../package.json';
|
||||
import { exitWithError } from './lib/helpers';
|
||||
|
||||
async function main(argv: string[]) {
|
||||
program.name('e2e-test').version(version);
|
||||
|
||||
registerCommands(program);
|
||||
|
||||
program.on('command:*', () => {
|
||||
console.log();
|
||||
console.log(chalk.red(`Invalid command: ${program.args.join(' ')}`));
|
||||
console.log();
|
||||
program.outputHelp();
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
program.parse(argv);
|
||||
}
|
||||
|
||||
process.on('unhandledRejection', (rejection: unknown) => {
|
||||
// Try to avoid exiting if the unhandled error is coming from jsdom, i.e. zombie.
|
||||
// Those are typically errors on the page that should be benign, at least in the
|
||||
// context of this test. We have other ways of asserting that the page is being
|
||||
// rendered correctly.
|
||||
if (
|
||||
rejection instanceof Error &&
|
||||
rejection?.stack?.includes('node_modules/jsdom/lib')
|
||||
) {
|
||||
console.log(`Ignored error inside jsdom, ${rejection?.stack ?? rejection}`);
|
||||
} else {
|
||||
if (rejection instanceof Error) {
|
||||
exitWithError(rejection);
|
||||
} else {
|
||||
exitWithError(new Error(`Unknown rejection: '${rejection}'`));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
main(process.argv).catch(exitWithError);
|
||||
@@ -42,7 +42,7 @@ export function spawnPiped(cmd: string[], options?: SpawnOptions) {
|
||||
shell: true,
|
||||
...options,
|
||||
});
|
||||
child.on('error', handleError);
|
||||
child.on('error', exitWithError);
|
||||
|
||||
const logPrefix = cmd.map(s => s.replace(/.+\//, '')).join(' ');
|
||||
child.stdout?.on(
|
||||
@@ -75,7 +75,7 @@ export async function runPlain(cmd: string[], options?: SpawnOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
export function handleError(err: Error & { code?: unknown }) {
|
||||
export function exitWithError(err: Error & { code?: unknown }) {
|
||||
process.stdout.write(`${err.name}: ${err.stack || err.message}\n`);
|
||||
|
||||
if (typeof err.code === 'number') {
|
||||
Reference in New Issue
Block a user