redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

chore: remove tests from CLI npm package

Open tatomyr opened this issue 3 years ago • 1 comments

What/Why/How?

WIP

ATM the resulting package (cd packages/cli && npm pack) contains tests. This intends to fix this.

Reference

Testing

Screenshots (optional)

Check yourself

  • [ ] Code is linted
  • [ ] Tested with redoc/reference-docs/workflows
  • [ ] All new/updated code is covered with tests

Security

  • [ ] Security impact of change has been considered
  • [ ] Code follows company security practices and guidelines

tatomyr avatar Sep 15 '22 13:09 tatomyr

Coverage report

❌ An unexpected error occurred. For more details, check console

Error: The process '/usr/local/bin/npm' failed with exit code 1
St.:grey_question:
Category Percentage Covered / Total
🟡 Statements
63.67% (-9.27% 🔻)
2776/4360
🔴 Branches
58.26% (-6.58% 🔻)
1559/2676
🔴 Functions
58.54% (-6.31% 🔻)
473/808
🟡 Lines
63.15% (-9.74% 🔻)
2562/4057
Show files with reduced coverage 🔻
St.:grey_question:
File Statements Branches Functions Lines
🔴 cli/src/utils.ts
25.93% (-5.93% 🔻)
1.19% (-11.9% 🔻)
16.67% (-10% 🔻)
25.93% (-5.93% 🔻)
🟢 cli/src/js-utils.ts
72.73% (-18.18% 🔻)
83.33%
75% (-25% 🔻)
80% (-20% 🔻)
🔴
... / lint.ts
0% (-77.19% 🔻)
0% (-76.47% 🔻)
0% (-60% 🔻)
0% (-78.57% 🔻)
🔴
... / join.ts
0% (-60.06% 🔻)
0% (-43.27% 🔻)
0% (-58.82% 🔻)
0% (-61.36% 🔻)
🔴
... / bundle.ts
0% (-87.1% 🔻)
0% (-52.5% 🔻)
0% (-100% 🔻)
0% (-86.89% 🔻)
🔴
... / push.ts
0% (-70.8% 🔻)
0% (-61.7% 🔻)
0% (-60% 🔻)
0% (-72.87% 🔻)
🔴
... / login.ts
0% (-41.67% 🔻)
0% 0%
0% (-41.67% 🔻)

Test suite run failed

Failed tests: 0/448. Failed suites: 6/85.
  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/runner/work/redocly-cli/redocly-cli/packages/cli/src/__tests__/fixtures/config.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const ConfigFixture = {
                                                                                             ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { ConfigFixture } from './../../__tests__/fixtures/config';
        | ^
      2 | import { Document, ResolveError } from '@redocly/openapi-core';
      3 | import { firstDocument, secondDocument } from '../documents';
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (packages/cli/src/__mocks__/@redocly/openapi-core.ts:1:1)


  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/runner/work/redocly-cli/redocly-cli/packages/cli/src/__tests__/fixtures/config.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const ConfigFixture = {
                                                                                             ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { ConfigFixture } from './../../__tests__/fixtures/config';
        | ^
      2 | import { Document, ResolveError } from '@redocly/openapi-core';
      3 | import { firstDocument, secondDocument } from '../documents';
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (packages/cli/src/__mocks__/@redocly/openapi-core.ts:1:1)


  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/runner/work/redocly-cli/redocly-cli/packages/cli/src/__tests__/fixtures/config.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const ConfigFixture = {
                                                                                             ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { ConfigFixture } from './../../__tests__/fixtures/config';
        | ^
      2 | import { Document, ResolveError } from '@redocly/openapi-core';
      3 | import { firstDocument, secondDocument } from '../documents';
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (packages/cli/src/__mocks__/@redocly/openapi-core.ts:1:1)


  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/runner/work/redocly-cli/redocly-cli/packages/cli/src/__tests__/fixtures/config.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const ConfigFixture = {
                                                                                             ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { ConfigFixture } from './../../__tests__/fixtures/config';
        | ^
      2 | import { Document, ResolveError } from '@redocly/openapi-core';
      3 | import { firstDocument, secondDocument } from '../documents';
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (packages/cli/src/__mocks__/@redocly/openapi-core.ts:1:1)


  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/runner/work/redocly-cli/redocly-cli/packages/cli/src/__tests__/fixtures/config.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const ConfigFixture = {
                                                                                             ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { ConfigFixture } from './../../__tests__/fixtures/config';
        | ^
      2 | import { Document, ResolveError } from '@redocly/openapi-core';
      3 | import { firstDocument, secondDocument } from '../documents';
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (packages/cli/src/__mocks__/@redocly/openapi-core.ts:1:1)


  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    /home/runner/work/redocly-cli/redocly-cli/packages/cli/src/__tests__/fixtures/config.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const ConfigFixture = {
                                                                                             ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { ConfigFixture } from './../../__tests__/fixtures/config';
        | ^
      2 | import { Document, ResolveError } from '@redocly/openapi-core';
      3 | import { firstDocument, secondDocument } from '../documents';
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (packages/cli/src/__mocks__/@redocly/openapi-core.ts:1:1)

Report generated by 🧪jest coverage report action from 1630c6e7f432d98c8e896deeb163c00eab48a953

github-actions[bot] avatar Sep 15 '22 13:09 github-actions[bot]

@tatomyr is it still relevant?

SmoliyY avatar Mar 16 '23 09:03 SmoliyY

Closing, this seems outdated (but re-open if we're ready to work on it) - should we capture the requirements as an issue so we can come back and meet the original goal in the future?

lornajane avatar Apr 20 '23 08:04 lornajane