samedi 29 octobre 2016

Use relative path when writing spec for atom package

I am writing tests for an Atom package and I have to open a text file (test.txt) which is at the same level of my package-spec.coffee file.

I used the following code to open my file:

atom.workspace.open('test.txt')
.then (content) ->
    text = content.buffer.getText()

However when I run the test with apm test the file is not opened because of relative paths. If I write the full path of the test.txt it works. How can I tell my script to use relative path, or how can I get the full path of my file. I cannot hardcode the full path because I want to run the tests with CircleCI, which has not the same paths as my local paths.

Aucun commentaire:

Enregistrer un commentaire