I'm running a job in gitlab CI and getting the following error when executing testcafe command.
The tests do pass locally.
Error
spawn /builds/testcafe-reporter/node_modules/nightmare/node_modules/electron/dist/electron ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Gitlab stage:
- yarn install --frozen-lockfile
- yarn add electron
- yarn testcafe:generatereport
package.json
{
"name": "testcafe-reporter",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"testcafe:generatereport": "yarn testcafe ./testcafeReportGeneratorTest.ts"
},
"dependencies": {
"node-html-parser": "^4.1.4",
"testcafe": "1.16.0",
"testcafe-browser-provider-nightmare": "^0.0.5",
"testcafe-reporter-html": "^1.4.6",
"testcafe-reporter-html-testrail": "^3.1.5",
"typescript": "^4.4.2"
}
}
.testcafec.json
{
"browsers": ["nightmare"],
"reporter": {
"name": "html",
"output": "testcafe/reports/report.html"
}
}
Please advise how can I resolve this?
I cannot reproduce this issue either locally or in Gitlab CI. Here are the files I am trying with:
.testcafec.json
{
"browsers": ["nightmare"],
"reporter": {
"name": "html",
"output": "testcafe/reports/report.html"
}
}
package.json
{
"name": "testcafe-reporter",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"testcafe:generatereport": "yarn testcafe ./testcafeReportGeneratorTest.ts"
},
"dependencies": {
"electron": "^14.0.0",
"nightmare": "^3.0.2",
"node-html-parser": "^4.1.4",
"testcafe": "1.16.0",
"testcafe-browser-provider-nightmare": "^0.0.5",
"testcafe-reporter-html": "^1.4.6",
"testcafe-reporter-html-testrail": "^3.1.5",
"typescript": "^4.4.2",
"vo": "^4.0.2"
}
}
testcafeReportGeneratorTest.ts
import { Selector } from 'testcafe';
fixture`A set of examples that illustrate how to use TestCafe API`
.page`http://devexpress.github.io/testcafe/example/`;
const developerName = Selector('#developer-name');
test('How to type text into an input (t.typeText user action)', async t => {
await t
.typeText(developerName, 'Peter')
.typeText(developerName, 'Paker', { replace: true })
.typeText(developerName, 'r', { caretPos: 2 })
.expect(developerName.value).eql('Parker');
});
Could you check if this issue is reproducible with these files?
Related
I'm trying to create an npm scripts configuration that compiles scss and uses browser-sync to reload the browser when files are written to the css directory.
The scss compilation works.
However, after the css is rewritten, browser-sync is not reloading the browser.
My package.json:
{
"name": "bob",
"version": "0.1.0",
"description": "testing",
"watch": {
"sass": {
"patterns": [
"./src/sass"
],
"extensions": "scss"
},
"bsReload": {
"patterns": [
"./src/css"
],
"extensions": "css"
}
},
"scripts": {
"dev": "concurrently \"npm run watch\" \"npm run bs\" ",
"bs": "browser-sync start --proxy \"http://mylocalsite.localdev\" ",
"bsReload": "browser-sync reload",
"watch": "npm-watch",
"serve": "http-server dist",
"sass": "sass --style=compressed ./src/sass/main.scss ./css/main.css"
},
"author": "Bob",
"license": "ISC",
"devDependencies": {
...
}
}
I'm following a tutorial for how to set up Codemirror with react. I download the package with - npm install #uiw/react-codemirror
This works, as it allows me to:
import CodeMirror from "#uiw/react-codemirror"
When I try to import themes or keymaps, however, I'm given an error:
Module not found: Error: Package path ./theme/monokai.css is not exported from package path/to/node_modules/codemirror
import "codemirror/theme/monokai.css"
Both #codemirror and codemirror are available in node_modules, however codemirror doesn't contain a themes directory.
The package.json for the codemirror directory:
{
"name": "codemirror",
"version": "6.0.1",
"description": "Basic configuration for the CodeMirror code editor",
"scripts": {
"test": "cm-runtests",
"prepare": "cm-buildhelper src/codemirror.ts"
},
"keywords": [
"editor",
"code"
],
"author": {
"name": "Marijn Haverbeke",
"email": "marijnh#gmail.com",
"url": "http://marijnhaverbeke.nl"
},
"type": "module",
"main": "dist/index.cjs",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"types": "dist/index.d.ts",
"module": "dist/index.js",
"sideEffects": false,
"license": "MIT",
"dependencies": {
"#codemirror/autocomplete": "^6.0.0",
"#codemirror/commands": "^6.0.0",
"#codemirror/language": "^6.0.0",
"#codemirror/lint": "^6.0.0",
"#codemirror/search": "^6.0.0",
"#codemirror/state": "^6.0.0",
"#codemirror/view": "^6.0.0"
},
"devDependencies": {
"#codemirror/buildhelper": "^0.1.5"
},
"repository": {
"type": "git",
"url": "https://github.com/codemirror/basic-setup.git"
}
}
Would be thankful for any ideas as to why I'm getting this error. I've tried uninstalling codemirror and downloading it again, however the error persists.
I switched to a version of react-codemirror that downloads codemirror: 5.x and it works now
You might want to use theme doc, and doc
I am new in PostCSS and I don't know, how to add preCSS plugin. Basically, I am using Tailwind, where is recommend PostCSS. But till today, I always used Sass in my projects. With this preCSS plugin, I can use Sass syntax - that's the goal.
My packagake.json
{
"name": "zs-skalova-layout-only",
"version": "1.0.0",
"description": "",
"main": "tailwind.config.js",
"scripts": {
"dev": "postcss css/tailwind.css -o tailwind-compil.css"
},
"author": "",
"license": "ISC",
"dependencies": {
"autoprefixer": "^10.1.0",
"postcss": "^8.2.1",
"postcss-cli": "^8.3.1",
"tailwindcss": "^2.0.2"
},
"devDependencies": {
"precss": "^4.0.0"
}
}
and here is my postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
precss: {},
}
}
No Webpack, Gulp or etc. solutions please.
Thanks for your help
I am trying to run a simple puppeteer script with jest.
Below is my package.json contents:
{
"name": "jest-puppeteer-project",
"version": "1.0.0",
"description": "Test framework using Jest and Puppeteer",
"main": "index.js",
"scripts": {
"test": "jest --forceExit"
},
"author": "Anil Kumar Cheepuru",
"license": "ISC",
"dependencies": {
"#babel/core": "^7.12.3",
"#babel/preset-env": "^7.12.1",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"jest-puppeteer": "^4.4.0",
"puppeteer": "^5.4.1"
}
}
Below is my jest-puppeteer.config.js contents:
module.exports = {
launch: {
headless: false,
},
browserContext: "default"
};
I have also set preset: "jest-puppeteer" in my jest.config.js file.
Below is the error I am getting in the console when I am trying to run the script using the command: npm run test
I tried to look for a solution in various sources, but no luck. Can anyone please help me with this?
If you installed jest locally into your project, then this command:
"scripts": {
"test": "jest --forceExit"
}
won't find your locally installed jest. Try changing it to ./node_modules/.bin/jest --forceExit:
"scripts": {
"test": "./node_modules/.bin/jest --forceExit"
}
When running tests using Jest, I need my .babelrc file for it to run.
When running npm start, it only works without the .babelrc file, with the error:
Unknown option: C:\...\babelrc.presets
I'm guessing it's to do with the version of babel I have, but I have tried to following "answer" to this question: Unknown option: .../.babelrc.presets
but to no avail.
Here is my package.json:
{
"name": "reactjs",
"version": "1.0.0",
"description": "",
"main": "src/app.js",
"author": "x",
"license": "ISC",
"scripts": {
"start": "webpack-dev-server --port 3000",
"test": "jest"
},
"jest": {
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"unmockedModulePathPatterns": [
"react",
"react-dom",
"react-addons-test-utils",
"fbjs"
]
},
"devDependencies": {
"babel-core": "^6.7.*",
"babel-jest": "^11.0.2",
"babel-loader": "^5.0.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"jest-cli": "^11.0.2",
"react-addons-test-utils": "^0.14.8",
"webpack": "^1.12.*",
"webpack-dev-server": "^1.10.*"
},
"dependencies": {
"react": "^0.13.3"
}
}
and my .babelrc:
{
"presets": [
"react",
"es2015"
]
}
and my webpack config, if it's relevant:
module.exports = {
entry: [
'./src/app.js'
],
output: {
path: __dirname,
filename: "bundle.js"
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/
}]
}
};
You've listed babel-core#^6 but are using babel-loader#5, update your babel-loader to the most recent version.
I can work with babel src --out-dir lib, but not with npm run XXX using babel-core#6.20.0 and babel-loader#6.2.9 .While I install Babel-cli#6.18.0 CLI globally on my machine, after I install babel-cli# locally project, it can works with npm run.