Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source maps ignored and incorrect line shown when using nyc #23

Closed
jonsadka opened this issue Apr 17, 2020 · 2 comments
Closed

Source maps ignored and incorrect line shown when using nyc #23

jonsadka opened this issue Apr 17, 2020 · 2 comments

Comments

@jonsadka
Copy link

Hi there,

First off, thank you for your work on this 😄. I have everything seemingly working butI keep seeing errors pointing to the first line of the built file. For example, notice how the error points to the use strict of line 1.

Screen Shot 2020-04-16 at 9 09 06 PM

I look at all the tickets and the closest was #19. I feel like I have something misconfigured but still stuck and hope someone can help. Thanks!

// test/utils/order.ts
import test from 'ava';

import {formatOrderDate} from '../../src/utils/order';
test('formatOrderDate > pretty prints the date', (t) => {
  t.is(formatOrderDate(1586130298135), 'April 5, 2220');
});
// build-temp/tests/utils/order.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = __importDefault(require("ava"));
const order_1 = require("../../src/utils/order");
ava_1.default('formatOrderDate > pretty prints the date', (t) => {
    t.is(order_1.formatOrderDate(1586130298135), 'April 5, 2220');
});
//# sourceMappingURL=order.js.map
// ava.config.js
export default {
  concurrency: 5,
  failFast: true,
  files: ['tests/**/*', '!tests/test-helpers'],
  failWithoutAssertions: false,
  nodeArguments: ['--trace-deprecation', '--napi-modules'],
  typescript: {
    extensions: ['ts', 'tsx'],
    rewritePaths: {
      '/': 'build-temp/',
    },
  },
  verbose: true,
};
// package.json
{
  "devDependencies": {
    "@ava/typescript": "^1.1.1",
    "ava": "^3.7.0",
  },
  ...
  "scripts": {
    ...
    "test": "test:build && nyc --reporter=text --reporter=text-summary ava",
    "test:build": "tsc --build tsconfig.tests.json"
  }
}
npx ava --version: 3.7.0
// tsconfig.tests.json
{
  "compilerOptions": {
    "esModuleInterop": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "build-temp"
    "resolveJsonModule": true,
    "sourceMap": true,
    "target": "esnext"
  },
  "include": ["src/**/*.ts", "src/**/*.json"],
  "exclude": ["dist", "node_modules", "**/*.spec.ts"],
  "baseUrl": ".",
  "paths": {
    "*": ["node_modules/*", "src/types/*"]
  }
  "include": ["tests/**/*.ts", "src/**/*.ts", "src/**/*.json"]
}
@novemberborn
Copy link
Member

Could you try by following the instructions in #20?

I do think we should try and handle source maps better in AVA itself. Stack trace handling is being refactored at the moment and that should land before we can tackle this, but will follow-up.

(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)

@jonsadka
Copy link
Author

To document incase others are having the same issue, this is related to nyc which others have reported istanbuljs/nyc#619. Removing nyc got source maps working

@jonsadka jonsadka changed the title Wrong line being shown for errors? Source maps ignored and incorrect line shown when using nyc Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants