miragejs / ember-cli-mirage

An Ember Addon to easily add Mirage JS to your Ember app.
http://ember-cli-mirage.com
MIT License
863 stars 441 forks source link

Patch #2559 for Windows #2561

Closed ijlee2 closed 10 months ago

ijlee2 commented 10 months ago

Description

As mentioned in https://github.com/miragejs/ember-cli-mirage/issues/2558#issuecomment-1767991362, on Windows, my team member @Ajanth wasn't able to run the desired server even after I updated ember-cli-mirage to v3.0.1 (see #2559).

We think the issue is related to config/environment.js#L14, due to process.env.PWD and the hardcoded /'s.

After replacing process.env.PWD with process.cwd() and / with path.join(), we checked that we can run the server on both Windows and Mac. On Mac, I saw the same value logged for (1), (2), and (3):

console.log('(1) ' + `${process.env.PWD}/server/proxies`);
console.log('(2) ' + path.join(process.env.PWD, 'server', 'proxies'));
console.log('(3) ' + path.join(process.cwd(), 'server', 'proxies'));

Note, a StackOverflow answer suggests that process.env.PWD and process.cwd() can have a different meaning (value) when the current directory is changed. I'm not sure if that difference would affect ember-cli-mirage.