Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump yeoman-environment from 3.19.3 to 4.1.3 #241

Merged
merged 3 commits into from
Jan 18, 2024
Merged
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: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = {
global: {
branches: 100,
lines: 100,
statements: 100
statements: 100,
functions: 100
}
}
}
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "npm run lint && npm run unit-tests",
"lint": "eslint .",
"unit-tests": "jest -c ./jest.config.js"
"unit-tests": "cross-env NODE_OPTIONS=--experimental-vm-modules ./node_modules/jest/bin/jest.js -c ./jest.config.js"
},
"repository": {
"type": "git",
Expand All @@ -29,6 +29,7 @@
"homepage": "https://github.com/adobe/generator-aio-app#readme",
"devDependencies": {
"@types/jest": "^29",
"cross-env": "^7.0.3",
"eol": "^0.9.1",
"eslint": "^8",
"eslint-config-standard": "^17",
Expand All @@ -40,17 +41,17 @@
"jest": "^29",
"stdout-stderr": "^0.1.13",
"yeoman-assert": "^3.1.1",
"yeoman-environment": "^3.2.0",
"yeoman-test": "^6.0.0"
"yeoman-environment": "^4",
"yeoman-test": "^8"
},
"dependencies": {
"@adobe/aio-lib-env": "^3",
"@adobe/generator-add-action-analytics": "^1",
"@adobe/generator-add-action-asset-compute": "^2",
"@adobe/generator-add-action-campaign-standard": "^1",
"@adobe/generator-add-action-customer-profile": "^1",
"@adobe/generator-add-action-target": "^1",
"@adobe/generator-add-action-generic": "^1",
"@adobe/generator-add-action-asset-compute": "^2",
"@adobe/generator-add-action-target": "^1",
"@adobe/generator-add-web-assets-exc-raw-html": "^1",
"@adobe/generator-add-web-assets-exc-react": "^1",
"@adobe/generator-app-asset-compute": "^2",
Expand Down
29 changes: 17 additions & 12 deletions test/generators/add-action/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
const helpers = require('yeoman-test')

const { utils, constants } = require('@adobe/generator-app-common-lib')
const AddActions = require('../../../generators/add-action')
Expand Down Expand Up @@ -57,6 +56,12 @@ const expectedChoices = {
// spies
const prompt = jest.spyOn(Generator.prototype, 'prompt')
const composeWith = jest.spyOn(Generator.prototype, 'composeWith')

let yeomanTestHelpers
beforeAll(async () => {
yeomanTestHelpers = (await import('yeoman-test')).default
})

beforeAll(() => {
// mock implementations
composeWith.mockReturnValue(undefined)
Expand All @@ -80,7 +85,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['skip-prompt'] = true
options['adobe-services'] = `${sdkCodes.analytics},${sdkCodes.target},${sdkCodes.campaign},${sdkCodes.customerProfile}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
// with skip prompt defaults to generic action
// make sure sub generators have been called
Expand All @@ -91,7 +96,7 @@ describe('run', () => {
})

test('no input, selects one generator', async () => {
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withPrompts({ actionGenerators: ['a'] })

expect(prompt).toHaveBeenCalledTimes(1)
Expand All @@ -117,7 +122,7 @@ describe('run', () => {
}))
})
test('no input, selects multiple generators', async () => {
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

expect(prompt).toHaveBeenCalledTimes(1)
Expand Down Expand Up @@ -146,7 +151,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = 'NOTEXITING'
options['--adobe-supported-services'] = 'notexistting'
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down Expand Up @@ -175,7 +180,7 @@ describe('run', () => {
test('--adobe-services="analytics,customerProfile"', async () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = `${sdkCodes.analytics},${sdkCodes.customerProfile}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down Expand Up @@ -206,7 +211,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = `${sdkCodes.analytics},${sdkCodes.customerProfile}`
options['supported-adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.target}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down Expand Up @@ -239,7 +244,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = `${sdkCodes.analytics},${sdkCodes.customerProfile}`
options['supported-adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.campaign},${sdkCodes.target}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down Expand Up @@ -271,7 +276,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.campaign},${sdkCodes.target}`
options['supported-adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.campaign},${sdkCodes.target}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down Expand Up @@ -301,7 +306,7 @@ describe('run', () => {
test('--adobe-services=ALL', async () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.campaign},${sdkCodes.target}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions({
'adobe-services': `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.campaign},${sdkCodes.target}`
})
Expand Down Expand Up @@ -334,7 +339,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = ''
options['supported-adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.target}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down Expand Up @@ -367,7 +372,7 @@ describe('run', () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['adobe-services'] = ''
options['supported-adobe-services'] = `${sdkCodes.analytics},${sdkCodes.assetCompute},${sdkCodes.customerProfile},${sdkCodes.campaign},${sdkCodes.target}`
await helpers.run(AddActions)
await yeomanTestHelpers.run(AddActions)
.withOptions(options)
.withPrompts({ actionGenerators: ['a', 'b', 'c'] })

Expand Down
8 changes: 6 additions & 2 deletions test/generators/add-ci/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ governing permissions and limitations under the License.

/* eslint-disable jest/expect-expect */ // => use assert

const helpers = require('yeoman-test')
const assert = require('yeoman-assert')
const fs = require('fs')
const path = require('path')

const theGeneratorPath = require.resolve('../../../generators/add-ci')
const Generator = require('yeoman-generator')

let yeomanTestHelpers
beforeAll(async () => {
yeomanTestHelpers = (await import('yeoman-test')).default
})

describe('prototype', () => {
test('exports a yeoman generator', () => {
expect(require(theGeneratorPath).prototype).toBeInstanceOf(Generator)
Expand All @@ -27,7 +31,7 @@ describe('prototype', () => {

describe('run', () => {
test('should create files under .github', async () => {
await helpers.run(theGeneratorPath)
await yeomanTestHelpers.run(theGeneratorPath)
.inTmpDir(dir => {
fs.writeFileSync(path.join(dir, '.env'), 'FAKECONTENT')
})
Expand Down
12 changes: 8 additions & 4 deletions test/generators/add-events/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
const helpers = require('yeoman-test')

const theGeneratorPath = require.resolve('../../../generators/add-events')
const Generator = require('yeoman-generator')
const cloneDeep = require('lodash.clonedeep')

// spies
const prompt = jest.spyOn(Generator.prototype, 'prompt')
const composeWith = jest.spyOn(Generator.prototype, 'composeWith')
beforeAll(() => {

let yeomanTestHelpers
beforeAll(async () => {
yeomanTestHelpers = (await import('yeoman-test')).default
})

beforeAll(async () => {
// mock implementations
composeWith.mockReturnValue(undefined)
})
Expand All @@ -43,7 +47,7 @@ describe('run', () => {
test('--skip-prompt "', async () => {
const options = cloneDeep(global.basicGeneratorOptions)
options['skip-prompt'] = true
await helpers.run(theGeneratorPath)
await yeomanTestHelpers.run(theGeneratorPath)
.withOptions(options)
// with skip prompt defaults to generic action
// make sure sub generators have been called
Expand Down
12 changes: 8 additions & 4 deletions test/generators/add-events/publish-events.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const helpers = require('yeoman-test')
const assert = require('yeoman-assert')
const fs = require('fs')
const yaml = require('js-yaml')
Expand All @@ -22,6 +21,11 @@ const Generator = require('yeoman-generator')

const { constants } = require('@adobe/generator-app-common-lib')

let yeomanTestHelpers
beforeAll(async () => {
yeomanTestHelpers = (await import('yeoman-test')).default
})

describe('prototype', () => {
test('exports a yeoman generator', () => {
expect(require(theGeneratorPath).prototype).toBeInstanceOf(Generator)
Expand Down Expand Up @@ -93,7 +97,7 @@ describe('run', () => {
options['skip-prompt'] = true
const prevDotEnvContent = 'PREVIOUSCONTENT\n'
try {
await helpers.run(theGeneratorPath)
await yeomanTestHelpers.run(theGeneratorPath)
.withOptions(options)
.inTmpDir(dir => {
fs.writeFileSync(path.join(dir, '.env'), prevDotEnvContent)
Expand Down Expand Up @@ -121,7 +125,7 @@ describe('run', () => {
const prevDotEnvContent = 'PREVIOUSCONTENT\n'
const options = cloneDeep(global.basicGeneratorOptions)
options['skip-prompt'] = true
await helpers.run(theGeneratorPath)
await yeomanTestHelpers.run(theGeneratorPath)
.withOptions(options)
.inTmpDir(dir => {
fs.writeFileSync('ext.config.yaml', yaml.dump({
Expand Down Expand Up @@ -157,7 +161,7 @@ describe('run', () => {
const prevDotEnvContent = 'PREVIOUSCONTENT\n'
const options = cloneDeep(global.basicGeneratorOptions)
options['skip-prompt'] = false
await helpers.run(theGeneratorPath)
await yeomanTestHelpers.run(theGeneratorPath)
.withOptions(options)
.withPrompts({ actionName: 'fakeAction' })
.inTmpDir(dir => {
Expand Down
Loading
Loading