1
0

Switch to ESM

This commit is contained in:
Eugen Wissner 2024-12-20 15:03:16 +01:00
parent 53e4c5dba6
commit 738f4f2bdb
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
22 changed files with 10709 additions and 5148 deletions

View File

@ -4,6 +4,9 @@ import axios from 'axios'
When('I request the same resource twice', async function () { When('I request the same resource twice', async function () {
const url = 'http://localhost:8080/' const url = 'http://localhost:8080/'
this.first = await axios.request(url).data const firstResponse = await axios.request(url)
this.second = await axios.request(url).data this.first = firstResponse.data
const secondResponse = await axios.request(url)
this.second = secondResponse.data
}) })

View File

@ -21,5 +21,9 @@ When('I request the same resource three times', function () {
Then('the responses should be the same', function () { Then('the responses should be the same', function () {
expect(this.first).to.equal(this.second) expect(this.first).to.equal(this.second)
if (this.third === undefined) {
return
}
expect(this.second).to.equal(this.third) expect(this.second).to.equal(this.third)
}) })

View File

@ -1,7 +0,0 @@
module.exports = {
presets: [
[ '@babel/env', {
useBuiltIns: 'usage'
}]
]
}

View File

@ -1,4 +1,4 @@
import { Given, When, Then } from 'cucumber' import { Given, When, Then } from '@cucumber/cucumber'
import { expect } from 'chai' import { expect } from 'chai'
Given('the following books by Simon Frank are in the collection:', function (dataTable) { Given('the following books by Simon Frank are in the collection:', function (dataTable) {

File diff suppressed because it is too large Load Diff

View File

@ -3,17 +3,14 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "cucumber-js --require-module '@babel/register'" "test": "cucumber-js"
}, },
"author": "Eugen Wissner <belka@caraus.de>", "author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0", "license": "MPL-2.0",
"dependencies": { "dependencies": {
"@babel/core": "^7.2.2", "@cucumber/cucumber": "^11.1.1",
"@babel/preset-env": "^7.2.3", "chai": "^5.1.2"
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.4",
"chai": "^4.2.0",
"cucumber": "^5.0.3"
} }
} }

View File

@ -1,5 +1,5 @@
const { Given, When, Then } = require('cucumber') import { Given, When, Then } from '@cucumber/cucumber'
const assert = require('assert') import assert from 'assert'
Given('the numbers:', function (dataTable) { Given('the numbers:', function (dataTable) {
this.numbers = dataTable.rows()[0] this.numbers = dataTable.rows()[0]

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,14 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "cucumber-js --format usage", "test": "cucumber-js --format usage",
"json": "cucumber-js --format json" "json": "cucumber-js --format json"
}, },
"author": "Eugen Wissner <belka@caraus.de>", "author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "dependencies": {
"cucumber": "^5.0.3" "@cucumber/cucumber": "^11.1.1"
} }
} }

View File

@ -1,7 +0,0 @@
module.exports = {
presets: [
[ '@babel/env', {
useBuiltIns: 'usage'
}]
]
}

View File

@ -1,4 +1,4 @@
import { Before, Given, Then } from 'cucumber' import { Before, Given, Then } from '@cucumber/cucumber'
import { expect } from 'chai' import { expect } from 'chai'
import _ from 'lodash' import _ from 'lodash'

View File

@ -1,4 +1,4 @@
import { Before, Given, Then } from 'cucumber' import { Before, Given, Then } from '@cucumber/cucumber'
import { expect } from 'chai' import { expect } from 'chai'
import R from 'ramda' import R from 'ramda'

View File

@ -1,4 +1,4 @@
import { Before, Given, Then } from 'cucumber' import { Before, Given, Then } from '@cucumber/cucumber'
import { expect } from 'chai' import { expect } from 'chai'
function step (name) { function step (name) {

View File

@ -1,4 +1,4 @@
import { setWorldConstructor } from 'cucumber' import { setWorldConstructor } from '@cucumber/cucumber'
setWorldConstructor(function () { setWorldConstructor(function () {
this.names = [] this.names = []

3897
reuse/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,21 +3,18 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "cucumber-js --require-module '@babel/register'" "test": "cucumber-js"
}, },
"author": "Eugen Wissner <belka@caraus.de>", "author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.2.2", "chai": "^5.1.2"
"@babel/preset-env": "^7.2.3",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.4",
"chai": "^4.2.0",
"cucumber": "^5.1.0"
}, },
"dependencies": { "dependencies": {
"@cucumber/cucumber": "^11.1.1",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"ramda": "^0.26.1" "ramda": "^0.30.1"
} }
} }

View File

@ -1,4 +1,4 @@
import { When, Then } from 'cucumber'; import { When, Then } from '@cucumber/cucumber';
import { expect } from 'chai'; import { expect } from 'chai';
When('the step definitions are written in {word}', function (language: string) { When('the step definitions are written in {word}', function (language: string) {

2861
ts/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,15 +3,19 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "cucumber-js --require-module 'ts-node/register' --require 'features/**/*.ts'" "test": "cucumber-js --loader 'ts-node/esm' --import 'features/**/*.ts'"
}, },
"author": "Eugen Wissner <belka@caraus.de>", "author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0", "license": "MPL-2.0",
"dependencies": { "dependencies": {
"chai": "^4.2.0", "@cucumber/cucumber": "^11.1.1",
"cucumber": "^5.0.3", "chai": "^5.1.2",
"ts-node": "^7.0.1", "ts-node": "^10.9.2",
"typescript": "^3.2.2" "typescript": "^5.7.2"
},
"devDependencies": {
"@types/chai": "^5.0.1"
} }
} }

View File

@ -1,5 +1,5 @@
const { Before, Given, When, Then, defineParameterType } = require('cucumber') import { Before, Given, When, Then, defineParameterType } from '@cucumber/cucumber'
const { expect } = require('chai') import { expect } from 'chai'
defineParameterType({ defineParameterType({
name: 'tobe', name: 'tobe',
@ -39,7 +39,7 @@ Before(function () {
this.count = 0 this.count = 0
}) })
Given(/(a regular expression|it) matches (this|that) pattern/, function (_, _) { Given(/(a regular expression|it) matches (this|that) pattern/, function (_x, _y) {
++this.count ++this.count
}) })

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,16 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "cucumber-js" "test": "cucumber-js"
}, },
"author": "Eugen Wissner <belka@caraus.de>", "author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"chai": "^4.2.0", "chai": "^5.1.2"
"cucumber": "^5.0.3" },
"dependencies": {
"@cucumber/cucumber": "^11.1.1"
} }
} }