Read text file from spec folder


#1

What’s the correct way of using a text file on a spec?

I won’t be testing the package’s editor features but some parsing done by coffeescript.

Is there a way to read a text file in the specs folder directly into coffeescript?
Should I programmatically open it on the editor? Or must I embed it in a string on the coffee file?


#2

For bundled default plugin, you’ll some with a fixtures folder. Those are used to test file system, either listing file within a folder or testing inside a typical code file.

Then it’s accessed with something like

or this
https://github.com/atom/find-and-replace/blob/master/spec/results-model-spec.coffee#L12-L21

Finally if you have a lot of small text to apply test, you can use setText