Skip to content

Commit 0bd1f61

Browse files
committed
test: always create a new directory when copying assets
1 parent 7c7c350 commit 0bd1f61

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

tests/e2e/setup/500-create-project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {join} from 'path';
22
import {git, ng, silentNpm} from '../utils/process';
3-
import {expectFileToExist} from '../utils/fs';
3+
import { expectFileToExist, writeFile } from '../utils/fs';
44
import {
55
useSha,
66
useNgVersion,

tests/e2e/utils/assets.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export function copyProjectAsset(assetName: string, to?: string) {
2020
}
2121

2222
export function copyAssets(assetName: string) {
23-
const tempRoot = join(getGlobalVariable('tmp-root'), 'assets', assetName);
23+
const seed = +Date.now();
24+
const tempRoot = join(getGlobalVariable('tmp-root'), 'assets', assetName + '-' + seed);
2425
const root = assetDir(assetName);
2526

2627
return Promise.resolve()
@@ -39,8 +40,6 @@ export function copyAssets(assetName: string) {
3940

4041

4142
export function createProjectFromAsset(assetName: string) {
42-
const packages = require('../../../lib/packages').packages;
43-
4443
return Promise.resolve()
4544
.then(() => copyAssets(assetName))
4645
.then(dir => process.chdir(dir))

tests/e2e/utils/git.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export function gitClean() {
1818
}
1919

2020
export function expectGitToBeClean() {
21-
return git('status', '--porcelain')
21+
return silentGit('status', '--porcelain')
2222
.then(({ stdout }) => {
2323
if (stdout != '') {
24-
throw new Error('Git repo is not clean...');
24+
throw new Error('Git repo is not clean...\n' + stdout);
2525
}
2626
});
2727
}
2828

2929
export function gitCommit(message: string) {
3030
return git('add', '-A')
31-
.then(() => git('status', '--porcelain'))
31+
.then(() => silentGit('status', '--porcelain'))
3232
.then(({ stdout }) => {
3333
if (stdout != '') {
3434
return git('commit', '-am', message);

tests/e2e/utils/process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type ProcessOutput = {
2222
};
2323

2424

25-
function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<ProcessOutput> {
25+
function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<ProcessOutput> {
2626
let stdout = '';
2727
let stderr = '';
2828
const cwd = process.cwd();

0 commit comments

Comments
 (0)