зеркало из https://github.com/microsoft/just.git
Scenario Testing - Part 1 (#55)
* WIP: adding scenario-tests * Scenario test part 1 feature complete * revert exec changes * fixing up code review comments
This commit is contained in:
Родитель
2cd5ed7768
Коммит
9326232ae4
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
common/temp/
|
|
@ -10,6 +10,7 @@ dependencies:
|
|||
'@babel/types': 7.3.2
|
||||
'@rush-temp/create-just': 'file:projects/create-just.tgz'
|
||||
'@rush-temp/example-lib': 'file:projects/example-lib.tgz'
|
||||
'@rush-temp/just-scenario-tests': 'file:projects/just-scenario-tests.tgz'
|
||||
'@rush-temp/just-scripts': 'file:projects/just-scripts.tgz'
|
||||
'@rush-temp/just-scripts-utils': 'file:projects/just-scripts-utils.tgz'
|
||||
'@rush-temp/just-stack-monorepo': 'file:projects/just-stack-monorepo.tgz'
|
||||
|
@ -19,7 +20,6 @@ dependencies:
|
|||
'@rush-temp/just-task-docs': 'file:projects/just-task-docs.tgz'
|
||||
'@rush-temp/just-task-logger': 'file:projects/just-task-logger.tgz'
|
||||
'@rush-temp/just-task-scripts': 'file:projects/just-task-scripts.tgz'
|
||||
'@types/fs-extra': 5.0.4
|
||||
'@types/glob': 7.1.1
|
||||
'@types/handlebars': 4.0.40
|
||||
'@types/jest': 23.3.13
|
||||
|
@ -1438,6 +1438,12 @@ packages:
|
|||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-DsknoBvD8s+RFfSGjmERJ7ZOP1HI0UZRA3FSI+Zakhrc/Gy26YQsLI+m5V5DHxroHRJqCDLKJp7Hixn8zyaF7g==
|
||||
/@types/fs-extra/5.0.5:
|
||||
dependencies:
|
||||
'@types/node': 10.14.4
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-w7iqhDH9mN8eLClQOYTkhdYUOSpp25eXxfc6VbFOGtzxW34JcvctH2bKjj4jD4++z4R5iO5D+pg48W2e03I65A==
|
||||
/@types/glob/7.1.1:
|
||||
dependencies:
|
||||
'@types/events': 3.0.0
|
||||
|
@ -1491,6 +1497,10 @@ packages:
|
|||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-nMRqS+mL1TOnIJrL6LKJcNZPB8V3eTfRo9FQA2b5gDvrHurC8XbSA86KNe0dShlEL7ReWJv/OU9NL7Z0dnqWTg==
|
||||
/@types/node/10.14.4:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==
|
||||
/@types/prompts/1.2.0:
|
||||
dev: false
|
||||
resolution:
|
||||
|
@ -11035,7 +11045,7 @@ packages:
|
|||
dev: false
|
||||
name: '@rush-temp/create-just'
|
||||
resolution:
|
||||
integrity: sha512-1PnWy5a+9ktkfBKL3z+0CFof7CCvVaLFJN1tyFzOxwWEBe4rLogH1hEuIL2EzdQOez1bzOaRwEU8Vayd5mT1+Q==
|
||||
integrity: sha512-VqPWxKXK5WJf7P1eyxQMhOEUXNiG6NvtGsWHJz1d2hlkasPumWCSP2FBB/VbkWmflRTC5aM1kTJyETP7CODKtQ==
|
||||
tarball: 'file:projects/create-just.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/example-lib.tgz':
|
||||
|
@ -11044,9 +11054,23 @@ packages:
|
|||
dev: false
|
||||
name: '@rush-temp/example-lib'
|
||||
resolution:
|
||||
integrity: sha512-aQJYnOTM5mj+8jLG1RPV3nJE/8yEUQrEqDlUq/e5OaihtNl+2r0shTotynRcOe+RfsZ2UeIRHIIx/r54xnwHYw==
|
||||
integrity: sha512-Z8ADj+DpjglEG4REQHlAoy6KevG1sADdXSDbru28DRIwd7U52mMk8V//pFdhWZuqWNPHRVRKfY+xQj4XWc85Ww==
|
||||
tarball: 'file:projects/example-lib.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-scenario-tests.tgz':
|
||||
dependencies:
|
||||
'@types/fs-extra': 5.0.5
|
||||
'@types/jest': 23.3.14
|
||||
'@types/node': 10.12.26
|
||||
fs-extra: 7.0.1
|
||||
jest: 23.6.0
|
||||
ts-jest: /ts-jest/23.10.5/jest@23.6.0
|
||||
dev: false
|
||||
name: '@rush-temp/just-scenario-tests'
|
||||
resolution:
|
||||
integrity: sha512-+jnl5KqgUuNsO6XxGjGq5Yg5Os2KYnKRFe4/sbB7L5VQ1CnY7AouYJAvFBihiHffEYagTZhe2lgt9hYyz2oDXg==
|
||||
tarball: 'file:projects/just-scenario-tests.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-scripts-utils.tgz':
|
||||
dependencies:
|
||||
'@types/fs-extra': 5.0.4
|
||||
|
@ -11073,11 +11097,12 @@ packages:
|
|||
semver: 5.6.0
|
||||
tar: 4.4.8
|
||||
ts-jest: /ts-jest/23.10.5/jest@23.6.0
|
||||
typescript: 3.3.3
|
||||
yargs: 12.0.5
|
||||
dev: false
|
||||
name: '@rush-temp/just-scripts-utils'
|
||||
resolution:
|
||||
integrity: sha512-//P/9UIZoMZ/jXrHOzliDpUC1b+u8lFvySOeWmmt5MW1EpDY9ODbC0BkVeBlIWtNafrElVuF38sudAbKpm3PvA==
|
||||
integrity: sha512-UukcnRXYP2zdlan0iCN3PaMdbdXc6cEq/P754tohohMGKXCfiFHVpsxBgNhIPKPhdzy5JXyeoASCO8pHE9nOWg==
|
||||
tarball: 'file:projects/just-scripts-utils.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-scripts.tgz':
|
||||
|
@ -11100,12 +11125,12 @@ packages:
|
|||
ts-loader: /ts-loader/5.3.3/typescript@3.3.3
|
||||
typescript: 3.3.3
|
||||
webpack: 4.29.5
|
||||
webpack-cli: 3.2.1
|
||||
webpack-cli: /webpack-cli/3.2.1/webpack@4.29.5
|
||||
webpack-merge: 4.2.1
|
||||
dev: false
|
||||
name: '@rush-temp/just-scripts'
|
||||
resolution:
|
||||
integrity: sha512-DYwcOzErchqXHKj7x0ZK0MjUEROS/HzpF9eSbuVJBQ5mhAoQAxe1DskeOsxkWrWt1JXmmUza0gpxKWSf5GXWlw==
|
||||
integrity: sha512-GGkkXH5ycwPhNovTUsVpLqQu21Np5fSzkpvjsRe27GOZgjwGVxOLLMGUDUMwv2MhTYNv2749SjPuWEcTVF44uQ==
|
||||
tarball: 'file:projects/just-scripts.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-stack-monorepo.tgz':
|
||||
|
@ -11118,7 +11143,7 @@ packages:
|
|||
dev: false
|
||||
name: '@rush-temp/just-stack-monorepo'
|
||||
resolution:
|
||||
integrity: sha512-uA3SznVlyblvLzdHQDt5hcb0iBd/GYQmSMXcINfIWPlTvbIrhY17nHfBNumYwzY/XC/7NUppz8IGmL3NrM+KRg==
|
||||
integrity: sha512-jzm3De+zoiaJTUdlZ041oyFXQHQavcpqEERufKif8oXv73SWzYrDWfOueue83ffQcXAZxLEXvv0TAMO1LXaX5Q==
|
||||
tarball: 'file:projects/just-stack-monorepo.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-stack-single-lib.tgz':
|
||||
|
@ -11131,7 +11156,7 @@ packages:
|
|||
dev: false
|
||||
name: '@rush-temp/just-stack-single-lib'
|
||||
resolution:
|
||||
integrity: sha512-o52aWVhjnvZ7DPHLeTSktxlAse3CzyX0Wf4bX5kRDR7ctqxNUkiN5O3pQ6P1aGyZmh3s0/UVdL2g+xYqYqKv7Q==
|
||||
integrity: sha512-bzu0woy+3NSlaiK4w87vmPtQSUdevAPfyHFa4G3EOjUBZlcJuNWMRjyVd4as1AHUj0Jsa6fm2f5T5kCiDGJRFg==
|
||||
tarball: 'file:projects/just-stack-single-lib.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-stack-uifabric.tgz':
|
||||
|
@ -11144,7 +11169,7 @@ packages:
|
|||
dev: false
|
||||
name: '@rush-temp/just-stack-uifabric'
|
||||
resolution:
|
||||
integrity: sha512-QnkhtPFAKaAHXC52n8ly65epIuvC/rslRdm6uQFv/dtV07tqt4l7TmaU3B8HP/iN9jvAdJ7fFZc5OcXGnJg2qw==
|
||||
integrity: sha512-l0ng8Sbh1oW1ar2uz6fSPTy5kEylwYfzJwUYVCZnPaOM1ZEYU6j2LRUfBnZWnMu5fy4Ae6cKkAAdBMFMeue91Q==
|
||||
tarball: 'file:projects/just-stack-uifabric.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-task-docs.tgz':
|
||||
|
@ -11189,15 +11214,17 @@ packages:
|
|||
'file:projects/just-task-scripts.tgz':
|
||||
dependencies:
|
||||
cpx: 1.5.0
|
||||
jest-cli: 23.6.0
|
||||
dev: false
|
||||
name: '@rush-temp/just-task-scripts'
|
||||
resolution:
|
||||
integrity: sha512-0VC9u8Mp+U6n07zRkj54o2oVf5AjiSpA+j0/NdIEoj0KphvZiQbu5hdY52QpdQT+j98oQZmPp+QuDzqe3gsWJQ==
|
||||
integrity: sha512-BOBMIZJ4ShHPCveUC5w2WEPOW4Jr6fBsvxuFeXxdEo0iqlkJQgKUB/Ud/rQp7c4wJl3VCviZV+GzA//T6iFOhw==
|
||||
tarball: 'file:projects/just-task-scripts.tgz'
|
||||
version: 0.0.0
|
||||
'file:projects/just-task.tgz':
|
||||
dependencies:
|
||||
'@types/jest': 23.3.13
|
||||
'@types/mock-fs': 3.6.30
|
||||
'@types/node': 10.12.21
|
||||
'@types/resolve': 0.0.8
|
||||
'@types/undertaker': 1.2.0
|
||||
|
@ -11205,6 +11232,7 @@ packages:
|
|||
'@types/yargs': 12.0.1
|
||||
chalk: 2.4.2
|
||||
jest: 23.6.0
|
||||
mock-fs: 4.8.0
|
||||
resolve: 1.10.0
|
||||
ts-jest: /ts-jest/23.10.5/jest@23.6.0
|
||||
typescript: 3.3.3
|
||||
|
@ -11214,7 +11242,7 @@ packages:
|
|||
dev: false
|
||||
name: '@rush-temp/just-task'
|
||||
resolution:
|
||||
integrity: sha512-9X7le0kn6l/mMRzxJ2BxE4CwPp19DO64Z0kLaPFtY/OSJg28NgaPf7DlvPS+DSnkKkt3z4JLyGF1v6zx83e6vw==
|
||||
integrity: sha512-UEstoANc3HzUoTmk2Y6Z503I9ch//tdCtSYywwHcl/P2ONVwlSZypY5bDo1MbmDYJnmzLUDgmFpPfWWo5CLN1A==
|
||||
tarball: 'file:projects/just-task.tgz'
|
||||
version: 0.0.0
|
||||
registry: 'https://registry.npmjs.org/'
|
||||
|
@ -11232,6 +11260,7 @@ specifiers:
|
|||
'@babel/types': ^7.1.2
|
||||
'@rush-temp/create-just': 'file:./projects/create-just.tgz'
|
||||
'@rush-temp/example-lib': 'file:./projects/example-lib.tgz'
|
||||
'@rush-temp/just-scenario-tests': 'file:./projects/just-scenario-tests.tgz'
|
||||
'@rush-temp/just-scripts': 'file:./projects/just-scripts.tgz'
|
||||
'@rush-temp/just-scripts-utils': 'file:./projects/just-scripts-utils.tgz'
|
||||
'@rush-temp/just-stack-monorepo': 'file:./projects/just-stack-monorepo.tgz'
|
||||
|
@ -11241,7 +11270,6 @@ specifiers:
|
|||
'@rush-temp/just-task-docs': 'file:./projects/just-task-docs.tgz'
|
||||
'@rush-temp/just-task-logger': 'file:./projects/just-task-logger.tgz'
|
||||
'@rush-temp/just-task-scripts': 'file:./projects/just-task-scripts.tgz'
|
||||
'@types/fs-extra': ^5.0.4
|
||||
'@types/glob': ^7.1.1
|
||||
'@types/handlebars': ^4.0.39
|
||||
'@types/jest': ^23.3.13
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
"scripts": {
|
||||
"postinstall": "node ./common/scripts/install-run-rush.js install",
|
||||
"build": "node ./common/scripts/install-run-rush.js build",
|
||||
"test": "node ./common/scripts/install-run-rush.js test",
|
||||
"build:docs": "node ./common/scripts/install-run-rush.js build -t just-task-docs",
|
||||
"postbuild": "node ./scripts/copyReadme.js",
|
||||
"start": "node ./scripts/watch.js",
|
||||
"test": "node ./common/scripts/install-run-rush.js test",
|
||||
"deploy": "node ./common/scripts/install-run-rush.js build && node ./common/scripts/install-run-rush.js publish -a -p -b master"
|
||||
},
|
||||
"keywords": [],
|
||||
|
|
|
@ -19,10 +19,10 @@ function checkEmptyRepo(projectPath: string) {
|
|||
|
||||
export async function initCommand(argv: yargs.Arguments) {
|
||||
// TODO: autosuggest just-stack-* packages from npmjs.org
|
||||
if (!argv.type) {
|
||||
if (!argv.stack) {
|
||||
let response = await prompts({
|
||||
type: 'select',
|
||||
name: 'type',
|
||||
name: 'stack',
|
||||
message: 'What type of repo to create?',
|
||||
choices: [
|
||||
{ title: 'Basic library', value: 'just-stack-single-lib' },
|
||||
|
@ -30,7 +30,7 @@ export async function initCommand(argv: yargs.Arguments) {
|
|||
{ title: 'Monorepo', value: 'just-stack-monorepo' }
|
||||
]
|
||||
});
|
||||
argv.type = response.type;
|
||||
argv.stack = response.stack;
|
||||
}
|
||||
|
||||
let name: string = '';
|
||||
|
@ -57,7 +57,7 @@ export async function initCommand(argv: yargs.Arguments) {
|
|||
|
||||
logger.info('Initializing the repo in the current directory');
|
||||
|
||||
const templatePath = await downloadPackage(argv.type);
|
||||
const templatePath = await downloadPackage(argv.stack);
|
||||
|
||||
if (templatePath) {
|
||||
applyTemplate(templatePath, paths.projectPath, { name });
|
||||
|
@ -66,7 +66,7 @@ export async function initCommand(argv: yargs.Arguments) {
|
|||
execSync('git add .');
|
||||
execSync('git commit -m "initial commit"');
|
||||
|
||||
if (argv.type.includes('monorepo')) {
|
||||
if (argv.stack.includes('monorepo')) {
|
||||
rushUpdate(paths.projectPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# Stage 1: puppeteer
|
||||
|
||||
FROM node:10-alpine as puppeteer
|
||||
|
||||
# Installs latest Chromium package.
|
||||
RUN apk update && apk upgrade && \
|
||||
echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
|
||||
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
|
||||
apk add --no-cache \
|
||||
chromium@edge \
|
||||
harfbuzz@edge \
|
||||
nss@edge \
|
||||
git \
|
||||
&& rm -rf /var/cache/*
|
||||
|
||||
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||
|
||||
# Stage 2: Use puppeteer
|
||||
|
||||
FROM puppeteer
|
||||
RUN git config --global user.email "someexample@somedomainyeahsomething.com" && git config --global user.name "Your Name"
|
||||
WORKDIR /app/packages/just-scenario-tests/
|
||||
CMD ["/usr/local/bin/npm", "run", "_dockerTest"]
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('../../scripts/jest.config');
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "just-scenario-tests",
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "docker build -t just-scenario-tests -f Dockerfile ../..",
|
||||
"test": "docker run -v $(pwd)/../..:/app just-scenario-tests",
|
||||
"_dockerTest": "jest --detectOpenHandles"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@types/node": "^10.12.18",
|
||||
"@types/jest": "^23.3.13",
|
||||
"@types/fs-extra": "^5.0.5",
|
||||
"create-just": ">=0.6.3",
|
||||
"just-scripts": ">=0.10.1 <1.0.0",
|
||||
"just-stack-monorepo": ">=0.6.11",
|
||||
"just-stack-single-lib": ">=0.5.9",
|
||||
"just-stack-uifabric": ">=0.7.11",
|
||||
"just-scripts-utils": ">=0.6.1 <1.0.0",
|
||||
"fs-extra": "^7.0.1",
|
||||
"ts-jest": "^23.10.5",
|
||||
"jest": "^23.6.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { spawnSync } from '../spawnSync';
|
||||
import { tmpPath } from '../tmpPath';
|
||||
|
||||
const toolsPath = path.join(__dirname, '../../node_modules');
|
||||
|
||||
describe('create-just', () => {
|
||||
beforeEach(() => {
|
||||
if (fs.pathExistsSync(tmpPath)) {
|
||||
fs.removeSync(tmpPath);
|
||||
}
|
||||
fs.mkdirpSync(tmpPath);
|
||||
});
|
||||
|
||||
it('can provision a monorepo', () => {
|
||||
const results = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
path.join(toolsPath, 'create-just/bin/create-just.js'),
|
||||
'-s',
|
||||
'just-stack-monorepo',
|
||||
'monorepo'
|
||||
],
|
||||
{ cwd: tmpPath }
|
||||
);
|
||||
|
||||
expect(results).toContain('All Set!');
|
||||
});
|
||||
|
||||
it('can provision a single lib', () => {
|
||||
const results = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
path.join(toolsPath, 'create-just/bin/create-just.js'),
|
||||
'-s',
|
||||
'just-stack-single-lib',
|
||||
'singlelib'
|
||||
],
|
||||
{ cwd: tmpPath }
|
||||
);
|
||||
|
||||
expect(results).toContain('All Set!');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
import cp, { SpawnSyncOptions } from 'child_process';
|
||||
import { tmpPath } from './tmpPath';
|
||||
|
||||
export function spawnSync(cmd: string, args: string[], options: SpawnSyncOptions) {
|
||||
const results = cp.spawnSync(cmd, args, { ...options, cwd: tmpPath });
|
||||
return results.stdout.toString() + results.stderr.toString();
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
import path from 'path';
|
||||
import os from 'os';
|
||||
const ToolPrefix = 'just-scenario-tests';
|
||||
export const tmpPath = path.join(os.tmpdir(), ToolPrefix);
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2015",
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"outDir": "lib",
|
||||
"strict": true,
|
||||
"strictBindCallApply": false,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
|
@ -43,6 +43,7 @@
|
|||
"@types/yargs": "12.0.1",
|
||||
"jest": "^23.6.0",
|
||||
"mock-fs": "^4.8.0",
|
||||
"ts-jest": "^23.10.5"
|
||||
"ts-jest": "^23.10.5",
|
||||
"typescript": "~3.3.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,16 +14,13 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"just-task": ">=0.7.5 <1.0.0",
|
||||
"just-scripts": "^0.7.0"
|
||||
"just-scripts": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"just-stack-single-lib": ">=0.1.0",
|
||||
"just-stack-uifabric": ">=0.1.0"
|
||||
},
|
||||
"just": {
|
||||
"stacks": [
|
||||
"just-stack-single-lib",
|
||||
"just-stack-uifabric"
|
||||
]
|
||||
"stacks": ["just-stack-single-lib", "just-stack-uifabric"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"strictPeerDependencies": false
|
||||
},
|
||||
|
||||
"nodeSupportedVersionRange": ">=8.9.4 <9.0.0 || >=10.9.0 <11.0.0",
|
||||
"nodeSupportedVersionRange": ">=8.9.4 <9.0.0 || >=10.9.0 <12.0.0",
|
||||
|
||||
"projectFolderMaxDepth": 3,
|
||||
|
||||
|
@ -119,6 +119,11 @@
|
|||
"packageName": "just-task-scripts",
|
||||
"projectFolder": "scripts",
|
||||
"shouldPublish": false
|
||||
},
|
||||
{
|
||||
"packageName": "just-scenario-tests",
|
||||
"projectFolder": "packages/just-scenario-tests",
|
||||
"shouldPublish": false
|
||||
}
|
||||
// {
|
||||
// "packageName": "just-stack-web-lib",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче