forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.spec.ts
46 lines (37 loc) · 1.47 KB
/
index.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/// <reference path="../../../../../cli/types/mocha/index.d.ts" />
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
import { join, resolve } from 'path'
import { expect } from 'chai'
describe('@cypress/schematic: ng-add', () => {
const schematicRunner = new SchematicTestRunner(
'schematics',
join(__dirname, './../collection.json'),
)
let appTree: UnitTestTree
const workspaceOptions = {
name: 'workspace',
newProjectRoot: 'projects',
version: '6.0.0',
}
const appOptions = {
name: 'sandbox',
inlineTemplate: false,
routing: false,
skipTests: false,
skipPackageJson: false,
}
beforeEach(async () => {
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise()
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise()
})
it('should create cypress files', async () => {
const files = ['cypress/integration/spec.ts', 'cypress/plugins/index.ts', 'cypress/support/commands.ts', 'cypress/support/index.ts', 'cypress/tsconfig.json', 'cypress.json']
const homePath = '/projects/sandbox/'
return schematicRunner.runSchematicAsync('ng-add', {}, appTree).toPromise().then((tree) => {
files.forEach((f) => {
const pathToFile = resolve(homePath, f)
expect(tree.exists(pathToFile), pathToFile).equal(true)
})
})
})
})