Closed ghost closed 4 years ago
@tallkid24 thanks for kind words!
Let's try isolate the issue
As you've mentioned it is unlikely that sorry cypress is to blame - it has no effect on tests themselves, it just tells cypress agents what spec file to run
@agoldis I actually think it might be because all of the cypress runs are running in the same codebuild directory, so the transpiling process is overwriting what a different thread of the cypress run is creating.
I did see a different error come up on the dashboard: Error: GraphQL error: Cannot return null for non-nullable field InstanceResults.tests.
@KyleThenTR good suggestion, I have extracted your comment https://github.com/agoldis/sorry-cypress/issues/40
@agoldis you were correct that it was an issue with transpiling and running all of the cypress threads on the same build machine. They were transpiling a file, and then the next runner would also transpile the same file, and the first test would pick up an incomplete file most likely.
For anyone else who comes across this issue, here is what I added in my plugins/index.js file.
const runUuid = uuid.v4();
on("file:preprocessor", (file) => {
if (config.env.createTranspileUuids) {
file.outputPath = file.outputPath.replace(/^(.*\/)(.*?)(\..*)$/, `$1$2.${runUuid}$3`);
}
return cypressTypeScriptPreprocessor(file);
});
This issue can be closed.
Interesting. I was having this issue with cypress-parallel + cucumber instead of sorry-cypress + typescript, fix seems to work.
function uuid() {
return Date.now().toString(36) + Math.random().toString(36).substring(2);
}
on('file:preprocessor', (file) => {
const runUuid = uuid();
if (config.env.createTranspileUuids) {
file.outputPath = file.outputPath.replace(/^(.*\/)(.*?)(\..*)$/, `$1$2.${runUuid}$3`);
}
return cucumber()(file);
});
I tried it below code in cypress 12.11 and it is not working
on('file:preprocessor', (file) => {
const id = uuid()
file.outputPath = file.outputPath.replace(
/^(.\/)(.?)(..*)$/,
$1$2.${id}$3
)
return filePreprocessor(file)
})
on(
'file:preprocessor',
browserify(config, {
typescript: require.resolve('typescript'),
})
)
I think I am the same issue. I have sorry cypress + cucumber + typescript. In my config flie I have :
on(
'file:preprocessor',
createBundler({
plugins: [createEsbuildPlugin(config)],
})
)
Cypress is running fine with one thread. If I try to launch several of them multiple times I have bunch of errors :
[2] 1) An uncaught error was detected outside of a test: [2] SyntaxError: The following error originated from your test code, not from Cypress. [2] [2] > Unexpected end of input
@TenPotatoes help out to resolve the issue
Hello, this project is great and works great most of the time! We run our tests on a Codebuild on AWS and run 5 threads of the Cypress runner parallel with the director service on AWS. About a quarter of the time, the first test on one of the threads fails with this error:
Now I'm not sure if this a sorry cypress issue or not, but I didn't have an issue with it before switching to running in parallel. If you don't think this is a sorry cypress issue, I can close this issue.
Tried many things to try to fix this, including setting modifyObtrusiveCode to false, chromeWebSecurity to false, upgrading Cypress. We are already catching uncaught exceptions so that doesn't seem like it should be the issue. I turned on some extra logs for this and here is the output
I couldn't really make anything of these errors, but maybe someone else can. I'm kind of out of ideas on what to try (I've tried more things today than I've listed but can't recall them all). Any ideas?