1

I've been playing around with testcafe-reporter-slack.

I face the following problem. First off, all my relevant .testcaferc.json settings for the reporter (just minus the webhook url :)):

{
    "name": "slack",
    "options": {
        "webhookUrl": "secret",
        "channel": "#testreporters",
        "username": "AlpineProOutletTestReporter",
        "loggingLevel": "SUMMARY",
        "quietMode": false
    }
}

When I fire up my tests ($ testcafe --test-meta retired=0 "chromium:headless"), the first part of the report gets reported to my slack channel:

enter image description here

this works fine.

The problem is that sometimes the final part of the report, created by reportTaskDone, doesn't get reported to my slack channel. It's simply lost. But at other times, it does work, and I can see the whole report:

enter image description here

Both times, I'm using the same tests, the same command to run them. Both times, my config is the same. I also took logs:

  • this log was generated when the final part was correctly reported to slack:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 't:headless:chromium' ]
2 info using npm@6.14.7
3 info using node@v14.8.0
4 verbose run-script [
4 verbose run-script   'pret:headless:chromium',
4 verbose run-script   't:headless:chromium',
4 verbose run-script   'postt:headless:chromium'
4 verbose run-script ]
5 info lifecycle @~pret:headless:chromium: @
6 info lifecycle @~t:headless:chromium: @
7 verbose lifecycle @~t:headless:chromium: unsafe-perm in lifecycle true
8 verbose lifecycle @~t:headless:chromium: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pavel/testing/alpine/AlpineProOutlet.Tests/node_modules/.bin:/home/pavel/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/pavel/.local/bin:/home/pavel/.gem/ruby/2.7.0/bin:
9 verbose lifecycle @~t:headless:chromium: CWD: /home/pavel/testing/alpine/AlpineProOutlet.Tests
10 silly lifecycle @~t:headless:chromium: Args: [ '-c', 'testcafe --test-meta retired=0 "chromium:headless"' ]
11 silly lifecycle @~t:headless:chromium: Returned: code: 1  signal: null
12 info lifecycle @~t:headless:chromium: Failed to exec t:headless:chromium script
13 verbose stack Error: @ t:headless:chromium: `testcafe --test-meta retired=0 "chromium:headless"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid @
15 verbose cwd /home/pavel/testing/alpine/AlpineProOutlet.Tests
16 verbose Linux 4.19.141-2-MANJARO
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "t:headless:chromium"
18 verbose node v14.8.0
19 verbose npm  v6.14.7
20 error code ELIFECYCLE
21 error errno 1
22 error @ t:headless:chromium: `testcafe --test-meta retired=0 "chromium:headless"`
22 error Exit status 1
23 error Failed at the @ t:headless:chromium script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
  • and this log was generated when the final part failed to be reported to slack:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 't:headless:chromium' ]
2 info using npm@6.14.7
3 info using node@v14.8.0
4 verbose run-script [
4 verbose run-script   'pret:headless:chromium',
4 verbose run-script   't:headless:chromium',
4 verbose run-script   'postt:headless:chromium'
4 verbose run-script ]
5 info lifecycle @~pret:headless:chromium: @
6 info lifecycle @~t:headless:chromium: @
7 verbose lifecycle @~t:headless:chromium: unsafe-perm in lifecycle true
8 verbose lifecycle @~t:headless:chromium: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pavel/testing/alpine/AlpineProOutlet.Tests/node_modules/.bin:/home/pavel/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/pavel/.local/bin:/home/pavel/.gem/ruby/2.7.0/bin:
9 verbose lifecycle @~t:headless:chromium: CWD: /home/pavel/testing/alpine/AlpineProOutlet.Tests
10 silly lifecycle @~t:headless:chromium: Args: [ '-c', 'testcafe --test-meta retired=0 "chromium:headless"' ]
11 silly lifecycle @~t:headless:chromium: Returned: code: 1  signal: null
12 info lifecycle @~t:headless:chromium: Failed to exec t:headless:chromium script
13 verbose stack Error: @ t:headless:chromium: `testcafe --test-meta retired=0 "chromium:headless"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid @
15 verbose cwd /home/pavel/testing/alpine/AlpineProOutlet.Tests
16 verbose Linux 4.19.141-2-MANJARO
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "t:headless:chromium"
18 verbose node v14.8.0
19 verbose npm  v6.14.7
20 error code ELIFECYCLE
21 error errno 1
22 error @ t:headless:chromium: `testcafe --test-meta retired=0 "chromium:headless"`
22 error Exit status 1
23 error Failed at the @ t:headless:chromium script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Yes, they are exactly the same:

$ diff 2020-09-04T22_44_57_715Z-debug.log 2020-09-04T22_47_25_555Z-debug.log 
Files 2020-09-04T22_44_57_715Z-debug.log and 2020-09-04T22_47_25_555Z-debug.log are identical

The only visual difference I can see is that when the last part doesn't get reported to slack, I don't see:

The following message is send to slack: 
 

:checkered_flag: Testing finished at *05/09/2020 00:44:56*
 :stopwatch: Duration: *1m 37s*
 :x: *1/13 failed*

in console.

I also tried deleting all node modules from my project ($ rm -rf node_modules/) and install everything again ($ npm install) with the following devDependencies in package.json:

"devDependencies": {
        "@babel/preset-env": "^7.10.4",
        "@ffmpeg-installer/ffmpeg": "^1.0.20",
        "babel-jest": "^26.1.0",
        "jest": "^26.1.0",
        "mssql": "^6.2.0",
        "nanoid": "^3.1.9",
        "testcafe": "^1.8.5",
        "testcafe-browser-provider-browserstack": "^1.13.0",
        "testcafe-reporter-html": "^1.4.6",
        "testcafe-reporter-json": "^2.2.0",
        "testcafe-reporter-slack": "git+https://github.com/pavelsaman/testcafe-reporter-slack.git",
        "testcafe-reporter-xunit": "^2.1.0"
    }

That didn't help either.

How can I make sure that the whole report gets reported to my slack channel? I'd also like to know how else I can debug this to find the root cause. I don't really know where else I can look to find out more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.