Question - Adding support for PureScript
See original GitHub issueHello! I recently discovered nyc, and before anything, I’d like to thank all the contributors for the work you’ve done, it is awesome ❤️
I’d like to know if there is support for non-mainstream languages, like PureScript, that compile to JavaScript. I’ve tried using nyc with a PureScript project, but the coverage reported is not quite true.
I know that nyc supports source mapping, and that’s what I used, but it reports no coverage.
The code that I have written for a test in PureScript is like this one:
module Test.Main where
import Prelude
import Effect (Effect)
import Test.Spec (describe, it)
import Test.Spec.Assertions (shouldEqual)
import Test.Spec.Reporter.Console (consoleReporter)
import Test.Spec.Runner (run)
import Components.Foo (foo)
main :: Effect Unit
main = run [consoleReporter] do
describe "something" do
it "tests" do
foo `shouldEqual` 42
which compiles to the following JavaScript
// Generated by purs version 0.12.5
"use strict";
var Components_Foo = require("../Components.Foo/index.js");
var Data_Eq = require("../Data.Eq/index.js");
var Data_Show = require("../Data.Show/index.js");
var Test_Spec = require("../Test.Spec/index.js");
var Test_Spec_Assertions = require("../Test.Spec.Assertions/index.js");
var Test_Spec_Reporter_Console = require("../Test.Spec.Reporter.Console/index.js");
var Test_Spec_Runner = require("../Test.Spec.Runner/index.js");
var main = Test_Spec_Runner.run([ Test_Spec_Reporter_Console.consoleReporter ])(Test_Spec.describe("something")(Test_Spec.it("tests")(Test_Spec_Assertions.shouldEqual(Data_Show.showInt)(Data_Eq.eqInt)(Components_Foo.foo)(42))));
module.exports = {
main: main
};
//# sourceMappingURL=index.js.map
The tested source file is Components.Foo:
module Components.Foo where
foo :: Int
foo = 42
which compiles to:
// Generated by purs version 0.12.5
"use strict";
var foo = 42;
module.exports = {
foo: foo
};
//# sourceMappingURL=index.js.map
In theory, it should report that I’m using at least foo. But it reports 0% of coverage:


Is there something that I can do on my side to allow using nyc with PureScript? Perhaps adding some hook to the test framework or something?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (1 by maintainers)

Top Related StackOverflow Question
Didn’t touch this apart from the quick tests I did when openened the issue sorry, perhaps some other user can give more insights
Hey, I wanted to give it a try with:
(spago changed the way you pass args to purs)
I end up with a large list containing all foreign imports and dependencies. Hard to tell if the result is still fine and using sourcemaps correctly.
Did you end up with using this to produce statistics? How did you use
nycs configuration arguments to useoutputfor sourcemaps, but ignore dependencies?^ this looks promising but still showing some
jsfiles, and missing some tested purescript files.