question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests silently pass when there is a broken import in the test code

See original GitHub issue

What are you trying to achieve?

For the tests to fail if there is a broken import in the Codecept testing code.

What do you get instead?

The tests silently do not run. There is no output to say there is an error. Our build pipeline passes.

Provide console output if related. Use --verbose mode for more details.

$ codeceptjs run --verbose
✨  Done in 10.10s.

Provide test source code if related

This occurred when we had a broken import, which was incorrectly copied from our actual website source code, so it didn’t resolve in the codecept project:

import { SOMETHING } from 'some/path/which/does/not/exist';

Feature('Some feature to test');

Scenario('Some scenario', ...

Details

  • CodeceptJS version: 1.4.6
  • NodeJS Version: v11.1.0
  • Operating System: Mac OS 10.14.2. Also replicated in Docker on Linux.
  • Protractor || WebDriverIO || Nightmare version (if related): Puppeteer 1.11.0
  • Configuration file:

(Ommitting some additional parts of the file for brevity, here’s the crux of it)

const config = {
  name: process.env.E2E ? 'e2e-tests' : 'functional-tests',
  helpers: {
    Puppeteer: {
      fullPageScreenshots: true,
      url,
      restart: true,
      show,
      waitForNavigation: 'networkidle0',
      waitForTimeout: 5000,
      windowSize: screenRes.windowSize,
      chrome: {
        args: [
          '--no-sandbox',
          '--disable-setui-sandbox',
          '--ignore-certificate-errors',
          '--ignore-certificate-errors-spki-list',
          '--allow-insecure-localhost',
        ],
        ignoreHTTPSErrors: true,
      },
    },
  },
  output: './output',
  include: {},
  multiple: {},
  mocha: {},
  bootstrap: done => {
    // Waits until the url returns a 200 response before any tests are performed
    waitOn({
      resources: [queryBuilder(url)],
      strictSSL: false,
      timeout: 10000,
    })
      .then(() => {
        done();
      })
      // i.e. most likely a timeout has occurred
      // In this case a get request is performed for access to more diagnostic information
      .catch(() =>
        requestPromise({
          url: queryBuilder(url),
          strictSSL: false,
        })
      )
      .catch(err => {
        console.error(`Something is wrong with the application at ${url}`);
        console.error(`Response code ${err.response.statusCode}`);
        console.error(err.response.body);
        process.exit(1);
      });
  },
  hooks: process.env.E2E ? ['./utils/helpers/custom-hook.js'] : [],
  gherkin: {},
  plugins: {
    screenshotOnFail: {
      enabled: true,
    },
  },
  tests,
  timeout: 10000,
};

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
DevinWatsoncommented, Apr 1, 2019

I’m seeing unhandled promise rejections in our steps file that are not causing tests to fail. Might be something similar.

(node:118) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: '393-494-951-070-6' == '039-349-494-818-0'

0reactions
zerkalicacommented, Jun 30, 2020

I found a bug, problem with typescript + target: ‘es5’

Uncomment target: "es2017" in https://github.com/zerkalica/codecept-ts-assert-bug/blob/master/tsconfig.codecept.json#L3

May be describe this moment in codecept documentation? I can’t found anything about ts setup.

Related:

#1520 #2005

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests silently pass when there is a broken import in the test code
For the tests to fail if there is a broken import in the Codecept testing code. What do you get instead? The tests...
Read more >
pytest fails silently when can't instantiate PyQt5.QtWidgets ...
When I run the following simple test. with my installation of Python 3.6.0 :: Anaconda custom (64-bit) , it passes.
Read more >
test — Regression tests package for Python — Python 3.11.1 ...
The goal for regression testing is to try to break code. This leads to a few guidelines ... Import as few modules as...
Read more >
Testing in Go: Failing Tests - Ilija Eftimov ‍
Golang's testing package promotes two types of failures. The first failure type immediately stops the tests from running. And the second failure ...
Read more >
Jest Testing like a Pro - Tips and tricks
A (long) summary of best practices and tips to test your code with Jest. ... test would pass silently, just because jest did...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found