You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Running w/out Jest prevents consistent filenames #149
We have over 6000 tests to run and are avoiding Jest since it adds an unbereable overhead.
Running without Jest prevents consistent test names, since the testId is automatically added.
The responsibility of the test name being unique should be in the hands of the implementator for manual tests, since changing the order of tests invalidates them (the original snapshot would not be found).
Hi @therealpecus, I am not sure what would be the best approach for unique ID generation. There is already an incremental test ID generation in place but I think for anything more sophisticated you need to have your own ID generator as part of your test and pass the test name to Differencify somehow
which returns NaN which in turns evaluates to true.
Running unchained allows to bypass this test. We already generate unique test names for each test, and pass it as a config to init():
constasyncTest=async([vid,breakpoint,filename,width,height,title],current='N/A',total='N/A')=>{// avoid Differencify chaining to ensure test filenames are not polluted by idsconsttarget=differencify.init({testName: `${vid}-${width}`,chain: false});constpage=awaittarget.newPage();awaitpage.setViewport({ width, height });awaitpage.goto(`http://localhost:3000/_variants/${theme}/${filename}.html`,{waitUntil: 'networkidle2'});constimage=awaitpage.screenshot();// override filenames including a test countertarget.testConfig.isJest=false;differencify.testId=undefined;target.testConfig.testId=undefined;consttest=awaittarget.toMatchSnapshot(image);console.info(`[${String(current).padStart(String(total).length)}/${total}] ${test ? '✅' : '❌'}${title} 'http://localhost:3000/_variants/${theme}/${filename}.html' (${breakpoint})`);awaitpage.close();};
We solved it by explicitely dropping out of Jest, and nullying both the global testId and test specific testId.
Hi @therealpecus , Sorry for the confusion. Yes, you are right and this needs to be fixed. Are you happy putting a fix for this? otherwise, I will prioritize a fix for at some point
Activity
NimaSoroush commentedon Jul 18, 2019
Hi @therealpecus, I am not sure what would be the best approach for unique ID generation. There is already an incremental test ID generation in place but I think for anything more sophisticated you need to have your own ID generator as part of your test and pass the test name to Differencify somehow
e.g.
therealpecus commentedon Jul 18, 2019
Hi @NimaSoroush
thanks for your reply. There is an issue with the current code, whereas the internal
testIdis always added when tests are run outside Jest.See this relevant snippet:
differencify/src/target.js
Lines 232 to 240 in 5ec7eef
The
elseadds thetestIdeven when thetestConfig.testNamehas been provided. It happens even whentestIdisundefined, because of:differencify/src/index.js
Line 60 in 5ec7eef
which returns
NaNwhich in turns evaluates totrue.Running unchained allows to bypass this test. We already generate unique test names for each test, and pass it as a config to
init():We solved it by explicitely dropping out of Jest, and nullying both the global
testIdand test specifictestId.NimaSoroush commentedon Jul 18, 2019
Hi @therealpecus , Sorry for the confusion. Yes, you are right and this needs to be fixed. Are you happy putting a fix for this? otherwise, I will prioritize a fix for at some point
therealpecus commentedon Jul 23, 2019
Sure! I'll make a PR.